Installing Ruby with Homebrew
in ~/.bash_profile
add the following line
export PATH=/usr/local/Cellar/ruby/1.9.3-p194/bin:$PATH
When you're done, close your terminal and re-open it. You should be fine.
Alternatively, you can execute the follwing in each open shell instead of closing/re-opening:
source ~/.bash_profile
Note:
I highly recommend installing ruby via rvm or rbenv so you can manage multiple ruby versions and use gemsets.
trouble upgrading ruby 2.6 on my MacOS 10.15.7
The best way to use ruby on mac is to use ruby version manager. I use rbenv. It allows you easly to switch between different ruby versions and doesn't cause conflicts.
To install it run brew install rbenv ruby-build
then echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
and finally source ~/.bash_profile
now install any ruby for example 3.0.0 by typing rbenv install 3.0.0
and set it globallyrbenv global 3.0.0
edit: This may not work if you're using different shell. Check what shell is your default by running echo $SHELL
If your default shell is zsh, then instead of your second and third steps run:
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc
gem install - fatal error: 'ruby/config.h' file not found in Mojave
If you have the Xcode 10 beta running this might fix it
sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
Related Topics
Retrieve Number from the String Pattern Using Regular Expression
How to Use Views and Layouts with Ruby and Erb (Not Rails)
Do All? and Any? Guarantee Short-Circuit Evaluation
How to Remove Duplicates in a Hash in Ruby on Rails
Ruby Converting String Encoding from Iso-8859-1 to Utf-8 Not Working
Difference Between or and || When Setting Variables
Can the Rails Tmp/Cache/Assets Files Be Safely Deleted
Rails Server Does Not Start by Command "Rails S"
Which Equality Test Does Ruby's Hash Use When Comparing Keys
Undefined Local Variable Based on Syntax in Ruby
Generate Nested Hashes from Strings and Deep Merging in Ruby
How to Access Cookies from Applicationcontroller (Rails)
Session Not Destroyed When Closing Browser - Railstutorial.Org
Why Ruby Inject Method Cannot Sum Up String Lengths Without Initial Value