How to install gems without sudo on Mac OS X
If you can't use gem
without sudo
, it sounds like you haven't initialized rbenv correctly because the shims aren't available.
These steps are from the documentation. Confirm you did them ALL:
Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility.
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
Ubuntu Desktop note: Modify your ~/.bashrc instead of ~/.bash_profile.
Zsh note: Modify your ~/.zshrc file instead of ~/.bash_profile.
Add rbenv init to your shell to enable shims and autocompletion.
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
Same as in previous step, use ~/.bashrc on Ubuntu, or ~/.zshrc for Zsh.
Restart your shell so that PATH changes take effect. (Opening a new terminal tab will usually do it.) Now check if rbenv was set up:
$ type rbenv
#=> "rbenv is a function"
Can't install RubyGems on mac: because Objective-C garbage collection is not supported
MacRuby is a completely different (and apparently unmaintained) re-implementation of the Ruby language based on macOS primitives. Given that MacRuby was never finished and was last updated in 2012, it appears that MacRuby is not compatible with modern macOS versions anymore.
With that being said, MacRuby is different from the "default" Ruby implementation usually called MRI or just ruby. On your Mac (as well as Linux, other *nix systems or Windows), you can just use the standard Ruby just fine.
To install the latest version of Ruby using RVM, you can run
rvm install 3.0
rvm use 3.0
At the time this answer was written, this will install and activate Ruby 3.0.2 on your Mac.
Related Topics
Error Pushing Ruby on Rails to Heroku
Boot Up Rails App, Make Request to App from Outside Local Network
Split String into Equal Slices/Chunks
Method Gives Activerecord::Relation Error
Complete Web Apps in Ruby Without Using Any Frameworks - How Difficult? Pitfalls
How to Set an Expectancy on Should_Receive and Have It Execute the Original Code
Could Not Find 'Cocoapods' (>= 0.A) Among 48 Total Gem(S) (Gem::Missingspecerror)
Why Are Database Entries Being Automatically Created When I Visit the "New" Page
Ruby String Prepend '\' Character
Ruby Get Permutations of All Lengths from a String in Order
How to Fix My Cucumber Expectation Error When Polling
Ruby Roo Loaderror: Cannot Load Such File -- Spreadsheet/Note
Watir Browser Process Doesn't Start Properly (Windows)
When Trying to Run Rspec, I Get "Uninitialized Constant Activemodel"
Seahorse::Client::Networkingerror Amazon S3 File Upload with Rails
Copy into Postgres with Arrays in Schema
On Destroying Session via Devise "Couldn't Find User with 'Id'=Sign_Out"
Difference Between "<%=" and "<%" When Mixing Ruby with HTML