You can check my previous article for a step by step tutorial. Install the Windows Subsystem for Linux, or WSL. To see the version of pacman which is the MSYS2 package manager. If you need to use an MSYS2 command, prefix it with ridk exec, e.g.: 1 ridk exec pacman -version (Personally, I’ve tested gosu, sinatra and rails with the native Ruby 2.4.4 installation.) On Windows Ruby it is more of a second class citizen, so expect problems with some gems. As mentioned before, Ruby is extensively tested on Unix. You can install gems and use the ruby command in the above Start Command Prompt with Ruby. Check the version you’ve installed with: 1 ruby -v Test your installation by using Start Command Prompt with Ruby, you should get a Windows Command Prompt in which you can use the ruby command. After the installation is finished, simply close the cmd.exe window. In the last phase of the installation, after you’ve pressed Finish, you will be asked to chose between three MSYS2 options. Make sure to check Use UTF-8 as default external encoding and keep the defaults for the remaining settings. As a general rule, you should use the version that is recommended on the RubyInstaller download page. At the time of this writing Ruby+Devkit 2.5.1-2 (圆4) has problems with gems like sqlite3 and rails. In my case, I’ve used Ruby+Devkit 2.4.4-2 (圆4). I strongly recommend to chose one of the WITH DEVKIT options especially if you plan to install third party Ruby gems. You can get the latest stable Ruby binary for Windows from RubyInstaller. That being said, let’s proceed with installing Ruby natively on Windows. Please note that in order to be able to use WSL you need a Windows 10 machine. If you can, I would recommend to install Ruby on WSL if you want to be able to follow most Ruby books and tutorials. Assuming that you have also installed Ruby 2.4.0, you can enable this locally in a project folder with: 1 cd my_project_path 2 rbenv local 2.4.0Īfter the above, Ruby 2.4.0 will be used in my_project_path and all subfolders of this path.įor historical reasons, Ruby always had better support on Unix like operating systems (e.g. If, for some reason, you want to be able use a different Ruby version per project, you can do it. If you want to revert to the system Ruby version, use: 1 rbenv global system The above commands will install Ruby 2.5.1 and make it globally available. If you want to install a particular version of Ruby you can use: 1 rbenv install 2.5.1 2 rbenv global 2.5.1 Restart the Terminal, or write: 1 source ~/.bash_profile Next, we are ready to install rbenv: 1 brew install rbenv 2 rbenv init 3 echo 'if which rbenv > /dev/null then eval "$(rbenv init -)" fi' > ~/.bash_profile In order to install rbenv we need to install Homebrew first: 1 /usr/bin/ruby -e "$(curl -fsSL )" The idea is to keep the system Ruby untouched and have a more modern version available. Easiest way to have an up-to-date Ruby installed on macOS is to install rbenv which will let you chose between Ruby installations. However, latest stable version of Ruby, 2.5.1, is faster and more up-to-date. Once the Command Line Tools are installed you will have a relatively new version of Ruby installed on your machine, 2.3 at the time of this writing. Open a Terminal and write: 1 xcode-select -install Please note, that you will need the Command Line Tools even if you’ve already installed Xcode. Start by installing the Command Line Tools for macOS. In this article I will show you how to install the latest stable version of Ruby, which is 2.5.1 at the time of this writing, on macOS, Windows 10 and Ubuntu 18.04. Solarian Programmer My programming ramblings Home Archives Contact Privacy Install Ruby 2.5 on macOS, Windows 10 and Ubuntu 18.04 Posted on Septemby Paul
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |