Dav*_*mar 4 fork zsh ruby-on-rails macos-catalina
我在 macOS Catalina 版本 10.15.1 下运行当我在项目上运行 Rails 控制台并尝试执行如下查询时User.first:
objc[57093]:调用 fork() 时,+[__NSCFConstantString 初始化] 可能已在另一个线程中进行。objc[57093]:调用 fork() 时,+[__NSCFConstantString 初始化] 可能已在另一个线程中进行。我们不能在 fork() 子进程中安全地调用它或忽略它。反而崩溃了。在 objc_initializeAfterForkError 上设置断点进行调试。
我按照这个答案添加OBJC_DISABLE_INITIALIZE_FORK_SAFETY到我的.zshrc文件中,如下所示:
ZSH=$HOME/.oh-my-zsh
# You can change the theme with another one:
# https://github.com/robbyrussell/oh-my-zsh/wiki/themes
ZSH_THEME="robbyrussell"
# Useful oh-my-zsh plugins for Le Wagon bootcamps
plugins=(git gitfast zsh-autosuggestions last-working-dir zsh-syntax-highlighting common-aliases history-substring-search)
# Prevent Homebrew from reporting - https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md
export HOMEBREW_NO_ANALYTICS=1
# Actually load Oh-My-Zsh
source "${ZSH}/oh-my-zsh.sh"
unalias rm # No interactive rm by default (brought by plugins/common-aliases)
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
# Load rbenv if installed (To manage your Ruby versions)
export PATH="${HOME}/.rbenv/bin:${PATH}"
type -a rbenv > /dev/null && eval "$(rbenv init -)"
# Load nvm if installed (To manage your Node versions)
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"
# Anaconda binaries (python, pip, conda, jupyter, pytest, pylint etc.)
export PATH="/anaconda3/bin:${HOME}/anaconda3/bin:${PATH}"
# Rails and Ruby uses the local `bin` folder to store binstubs.
# So instead of running `bin/rails` like the doc says, just run `rails`
# Same for `./node_modules/.bin` and nodejs
export PATH="./bin:./node_modules/.bin:${PATH}:/usr/local/sbin"
# Store your own aliases in the ~/.aliases file and load the here.
[[ -f "$HOME/.aliases" ]] && source "$HOME/.aliases"
# Encoding stuff for the terminal
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export EDITOR=atom
Run Code Online (Sandbox Code Playgroud)
当我在终端中运行时,echo $OBJC_DISABLE_INITIALIZE_FORK_SAFETY我得到“是”,所以我认为环境变量已正确设置......但这并不能解决问题。
我该如何解决这个问题?
| 归档时间: |
|
| 查看次数: |
3035 次 |
| 最近记录: |