天蓬老师2017-04-24 09:13:01
You can look at it like this
type ruby
The result should be
/usr/bin/ruby
This is ruby2.0 pre-installed on the system
Use brew install ruby and it will be installed in the /usr/local/Cellar/ruby/2.2.3/bin/ruby
path
ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
@caoh ➜ ~ /usr/local/Cellar/ruby/2.2.3/bin/ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
PHP中文网2017-04-24 09:13:01
It is best to use RVM to install Ruby on mac, which is convenient for management and does not require sudo permissions
PHP中文网2017-04-24 09:13:01
Just configure the environment variables under your bash_profile. .
But still use rvm to install, otherwise you may encounter strange problems: the original system version will appear inexplicably. .
ringa_lee2017-04-24 09:13:01
You first use brew info ruby
命令看一下有几个版本
然后用brew switch ruby
版本号 就可以切换到指定版本
比如brew switch ruby 2.2.3
to switch to version 2.2.3
In fact, brew just redoes the soft link