This is a guide to install Ruby and the web development framework Rails on Windows 10, OS X 10.11 "El Capitan", and Ubuntu 16.04 "Xenial Xerus".
- Join the Windows Insider program by Microsoft.
- Update your Windows via the Windows 10 Upgrader and Settings > Update & Security > Windows Update.
- Enable the Developer Mode in Settings > Update & Security > For Developers.
- Install the Windows Subsystem for Linux in Control Panel > Programs and Features > Turn Windows Features On or Off.
- Run bash form your Start Menu and follow the installation process. The password you set for your user account will be your sudo password. Do not lose it!
- Run Bash on Ubuntu for Windows from your Start Menu. It got an Ubuntu logo now.
- You are now in a basic Ubuntu 14.04 environment in Windows 10 and are able to run Linux applications!
- From this point on you can follow the instructions for Ubuntu.
- There might be some premission error with bundler which you can fix with
chmod +t -R ~/.bundleinside the folder of the Rails project. - The local development server will also be reachable in your Windows environment on localhost:3000.
- Update your system with
sudo apt-get updateandsudo apt-get dist-upgradeand clean up withsudo apt-get autoclean. - Install a bunch of dependencies with
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev. - Go to your home directory with
cdand get rbenv and its ruby-build plugin viagit clone https://github.com/rbenv/rbenv.git ~/.rbenvandgit clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build. Import them to your shell withecho 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc,echo 'eval "$(rbenv init -)"' >> ~/.bashrc, andecho 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc. Then reload your shell withexec $SHELL. - Now it is time to get Ruby with
rbenv install 2.3.1and point your shell to it withrbenv global 2.3.1. Check if it worked withruby -vandgem -v. - Update your gems with
gem update --systemandgem update. Also get bundler withgem install bundler. Dorbenv rehashafterwards. - Modern Rails has a lot of depencencies to JavaScript so we need to get Node.js (including npm) via
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -andsudo apt-get install nodejs. Check if it works withnode -vandnpm -v - Now finally we get Rails with
gem install rails -v 4.2.7andrbenv rehash. Check if it works withrails -v. - The final check will be done with
rails new anapp, followed bycd anapp, andrails s. The local development server will be reachable on localhost:3000.
- Update your system via App Store > Updates.
- Install Homebrew with
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)". You enter all this commands into Terminal or iTerm. - Install rbenv and its ruby-build plugin via Homebrew with
brew install rbenv ruby-build. Import them to your shell withecho 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profileandsource ~/.bash_profile. - Now it is time to get Ruby with
rbenv install 2.3.1and point your shell to it withrbenv global 2.3.1. Check if it worked withruby -vandgem -v. If something does not work close Terminal or iTerm completly, start it again, and try again. - Update your gems with
gem update --systemandgem update. Also get bundler withgem install bundler. Dorbenv rehashafterwards. - Modern Rails has a lot of depencencies to JavaScript so we need to get Node.js (including npm) via Homebrew with
brew install node. Check if it works withnode -vandnpm -v - Now finally we get Rails with
gem install rails -v 4.2.7andrbenv rehash. Check if it works withrails -v. - The final check will be done with
rails new anapp, followed bycd anapp, andrails s. The local development server will be reachable on localhost:3000.
If you want to install other versions than given above you can do that. If you know the version you need, then just replace that version number with those I gave. If you are not sure which versions are avaivable then do:
rbenv install --listfor Rubygem list rails --remote --allfor Rails
For the case that you want to use the more current but less stable Node.js 6 do this instead of the given above:
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -.
- Update your system via App Store > Updates.
- Install Postgress.app with normal drag and drop install procedure and start it.
- Install the pg gem manually (not with bundler) with
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config. - Your PostgreSQL database is now running at localhost:5432.