How to define a uniq ruby version on Mac OS High-Sierra?
Without any answer, the only way I found was to remove all ruby versions:
> brew remove --force ruby
> brew uninstall --ignore-dependencies ruby
> brew uninstall --force ruby
> sudo rm -rf /usr/local/lib/ruby
> sudo rm -rf ~/.rbenv
> sudo rm -rf ~/.gem
Now I use 2.3.3
version everywhere.
> ruby -v
# => 2.3.3
In brew config
:
Homebrew Ruby: 2.3.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
I can find my gems in /Library/Ruby/Gems/2.3.0/gems
:
gem which sass
# => /Library/Ruby/Gems/2.3.0/gems/sass-3.5.4/lib/sass.rb
To install a new gem, super user privileges are required:
sudo gem install <gem name>
Thanks for help. Maybe It helps.
How to reset anything related to Ruby to factory settings on Mac OS High Sierra
I would close & reopen your terminal window before you start all of this to make sure you don't have any old env vars loaded.
General things:
- Run
env | grep RUBY
,env | grep RVM
and look for any leftover environment variables that you may have set - Same for
env | grep GEM
. Sometimes you'll seeGEM_PATH
,GEM_HOME
, etc. but these aren't necessary for system ruby - Peek inside your
~/.bash_profile
,~/.bashrc
, and~/.profile
files and see if you've added any rvm stuff
If you're running macOS Mojave (I'm comparing against my system):
which ruby
should return /usr/bin/ruby
. If it doesn't, you have something else interfering. Post what that is and we can get it fixed.
Running /usr/bin/ruby --version
should return ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
Permissions for system ruby:
-r-xr-xr-x 1 root wheel 52016 Nov 30 02:38 /usr/bin/ruby
This should be something like sudo chmod 555 /usr/bin/ruby
to fix this if yours is difference. If you have different owners you'll need to sudo chown root:wheel /usr/bin/ruby
You'll also want to check which gem
, and see if it reports /usr/bin/gem
. Permissions should be the same as /usr/bin/ruby
. /usr/bin/gem --version
should return 2.5.2.3
Running /usr/bin/gem env
should return something similar-ish to below. Replace jay
(my computer user) with yours
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.2.3
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin18]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/jay/.gem/ruby/2.3.0 # this doesn't matter much
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/jay/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-18
- GEM PATHS:
- /Library/Ruby/Gems/2.3.0
- /Users/jay/.gem/ruby/2.3.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => false
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["https://rubygems.org/"]
- "benchmark" => true
- "gem" => "--document=yri"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /Users/jay/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
From there you've got two directories you probably want to look at:
Run ls -al /Library/Ruby/
. You should see this:
drwxr-xr-x 3 root wheel 96 Aug 17 18:59 Gems
drwxr-xr-x 3 root wheel 96 Aug 17 18:59 Site
You may need to chmod/chown each of those directories (with -R
for recursive)
When you're done, please note that running /usr/bin/gem install bundler
and gem install bundler
(assuming you haven't installed a new ruby version manager) should yield an error as below (this means you re-configured the permissions correctly).
Fetching: bundler-1.17.2.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
You'll see some tutorials mention changing those permissions, or running sudo to install gems but I don't recommend that. My favorite ruby version manager is asdf which may be worth a look. You'll install the core, and the ruby plugin.
This should get you a little bit closer. If you see anything else messed up, please post the error.
recompiled ruby - now mach-o, but wrong architecture macvim error
Updating to the latest snapshot fixed this. Snapshot link
install CommandT in OsX mojave . I got Error Vim Command-T plugin error: could not load the C extension
I also met this problem after I did brew upgrade
today. I fixed it by following steps:
- Update command-t fist.
cd ~/.vim/bundle/command-t/
git pull
git submodule update --remote --merge
- Update ruby
brew reinstall ruby
- Add ruby into PATH.
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
- Check ruby version is updated to 2.6
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
- Build commant-t again
cd ~/.vim/bundle/command-t/
rake make
Hope those steps could solve your problem.
Related Topics
How to Disable a Form Submit Button "A Là Ruby on Rails Way"
Decoding Facebook's Signed Request in Ruby/Sinatra
Is Assignment in a Conditional Clause Good Ruby Style
How to Get a Substring from Position N to the Last Char in Ruby
What Grammar Based Parser-Generator Tools Exist for Ruby
Rails: Update Model Attribute Without Invoking Callbacks
Why Does Date Exist in Ruby Before It Is Required
Is There a Ruby Http Client Library with a Response Cache
How to Create a Form in Rails Without Having to Use Form_For and a Model Instance
How to Write a JSON Schema for Array of Objects
Consuming Non-Rest APIs in Rails with Activeresource
Is There a Ruby One-Line "Return If X"
Are There Any Good Mutation Testing Tools for Ruby 1.9 and Rspec2