Installing Ruby-on-Rails For MacOS
Installing Ruby-on-Rails
For MacOS:
Enter the commands in a terminal without typing the beginning $ sign. Make sure that (1) you are using Mac OS and zsh terminal (latest version is best; if you are using the bash terminal, upgrade it to zsh) (2) you have admin privilege (3) VS Code is using zsh (otherwise, google how to change VS Code terminal to zsh).
Precaution: One of those silly things? your MacOS account name (not your full name) has to be one word. Open a terminal and execute the pwd command and check the account name. In my case, I see /Users/mtirfan, which means that my account name is mtirfan. The account name has to be one single word without any spaces. Otherwise, any script will fail to recognize paths correctly. There's a way of fixing it, as shown here. Check out the account name johnappleseed there which is one word and matches the home folder name. Follow the procedure outlined there for changing the home folder name followed by changing the account name. These two names must be the same (case-sensitive). Restart the computer.
1. Install homebrew: installing Rails (and numerous other packages) becomes easy if you have homebrew installed. To check whether you have it installed, enter the following command: $ brew --version
If it throws an error, you don't have homebrew. In that case, install homebrew using the following command.
$ /bin/bash -c "$(curl -fsSL )"
2. Update homebrew: Even if you had homebrew installed beforehand, update your version of homebrew and upgrade all the packages it installed by running the following command. $ brew update && brew upgrade
Also run the following to check any issues with homebrew. Follow the suggestions shown. $ brew doctor
To be conservative, restart your computer. It resolves issues with not restarting the terminal properly.
3. Install rbenv, a Ruby version manager. Install rbenv. $ brew install rbenv ruby-build
Look at the output in the terminal and strictly follow all the suggestions. If you get a
message telling you to add export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$ (brew --prefix openssl@1.1)" to ~/.zshrc (or ~/.bash_profile for older MacOS), do the following (replace ~/.zshrc by ~/.bash_profie as needed). If no instruction is given, don't do the things mentioned in this paragraph. Run the command open ~/.zshrc. If ~/.zshrc does not exist, run touch ~/.zshrc to create the file first before opening it. Insert the line export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" at the end of the file (in a new line), and save the file. Similarly process all suggested edits to ~/.zshrc, including inserting the export CPPFLAGS or export LDFLAGS if you are told to do so.
Make sure rbenv loads every time you open a terminal. Here, we are assuming zsh is your terminal. If you are using bash terminal, replace ~/.zshrc with ~/.bash_profile in the following two commands. $ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
Execute the .zshrc script. $ source ~/.zshrc
Exit all terminals by pressing Command and Q together. Then, open a new terminal.
Install Ruby. This will not interfere with the MacOS's version of Ruby. The minus ell (-l) term in the first line below lists the latest stable versions. Choose one (I'm choosing 3.1.2). $ rbenv install -l $ rbenv install 3.1.2
Make rbenv's Ruby version the default Ruby. Then reload ~/.zshrc. $ rbenv global 3.1.2 $ source ~/.zshrc
Check the version. It should be the one you chose. $ ruby -v
4. Install Rails. Run the following command. $ gem install rails
If you get any permission error, then run the following commands [replace mtirfan by your user name]: $ sudo chown -R mtirfan /Users/mtirfan/.rbenv $ gem install rails
Manually update rbenv. $ rbenv rehash
Check the version of rails.
$ rails -v
5. Install Database. Mac already has SQLite installed. The following command installs a Ruby gem for Ruby to connect to SQLite. $ gem install sqlite3
6. Set Up the Server. Run the following command. Strictly follow all instructions on screen (e.g., brew install node). $ brew install yarn
Finally, press Command+Q to shut down the terminal.
For Windows:
1. Install git for windows (go to ).
2. Install SQLite DBMS: Extract the contents of the zip file "sqlite-dll-win64-x64-3310100.zip" from https://
download.html into Ruby's bin folder. For example, I've copied the DLL and the DEF files into my Ruby's bin folder, which is "C:\Ruby200-x64\bin". If later on you get an error message, build sqlite from the source and do the installation following the 9 steps from "". (Note that you may omit Step 1, as you have already installed Ruby development kit while installing Ruby.)
3. Run the following command. Folder names like Ruby200-x64 might be different in your computer. $ gem install sqlite3 --platform=ruby -- --with-sqlite3-include=c:\Ruby200x64\sqlite3\include --with-sqlite3-lib=c:\Ruby200-x64\sqlite3\lib --with-sqlite3-dir=c: \Ruby200-x64\sqlite3\bin
4. Run the following command to install rails. $ gem install rails
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- speech on education for students
- videos on studying for exams
- place ad on craigslist for free
- how to sell on amazon for beginners
- installing numpy on windows
- installing nodejs on ubuntu 18 04
- installing matplotlib on python 3 8 3
- installing gmail on windows 10
- installing ram on motherboard
- installing pistons on rods
- installing grammarly on microsoft word
- installing numpy on python 3 8