How To Configure Your Mac to do Ruby on Rails Development by inertia

View this thread on steempeak.com
· @inertia ·
$13.33
How To Configure Your Mac to do Ruby on Rails Development
This is the most flexible configuration I'm aware of for doing Ruby on Rails development.  The goal is to have any version of `ruby` at your finger tips, so that any version of `rails` can be utilized.  This allows you to work on older projects as easily as newer ones.

The key to doing this is using `rvm` (Ruby Version Manager).  Another advantage to using `rvm` is that once everything is installed, you won't have to use `sudo` to install gems or do regular development.

I recommend MacPorts instead of Homebrew.

---

#### Step 1 - Install MacPorts

Install MacPorts from the package on the site:

https://www.macports.org/

Once MacPorts is installed, do a self update:

```bash
$ sudo port selfupdate
```

This will prompt you to install `xcodebuild`.

![](https://cl.ly/1L0R0C0v2J16/Screen%20Shot%202017-04-21%20at%202.51.47%20PM.png)

Once it's installed, make sure everything is up to date:

```bash
$ sudo port upgrade outdated
```

---

#### Step 2 - Install Ruby Version Manager

Before installing `rvm`, we need to install `gpg`.

```bash
$ sudo port install gnupg gnupg2
```

Next, install `rvm` from the steps on the site:

https://rvm.io/

---

#### Step 3 - Installing Ruby

Close your terminal window and relaunch the terminal to load the new path.  Now, we can install a more modern version of `ruby`.

```bash
$ rvm install ruby-2.2.5
```

---

#### Step 4 - Installing Rails

Now that we have a new `ruby` version, we can install `rails`.

```bash
$ gem install rails
```

Note, this version of `rails` will be associated with this version of `ruby`.  If you switch to another version of `ruby`, you'll have to install `rails` again.

---

#### Step 5 - Starting a Rails Project

```bash
$ rails new hello_world
$ cd hello_world
$ rails s
```

The server will start and we can take a look by opening the browser:

http://localhost:3000/

![](https://cl.ly/3q1u3O3M2I0X/Screen%20Shot%202017-04-21%20at%202.31.55%20PM.png)

To close the server, press `^C` in the terminal.

---

#### Step 6 - Anvil

If you're working on a bunch of projects, it's nice to be able to run them as needed without having to launch `rails s`.  This tool will make it easy:

https://anvilformac.com

After installation, click on the anvil icon at the top of the screen and let it install `pow`.

![](https://cl.ly/45180k0t051f/Screen%20Shot%202017-04-21%20at%202.36.25%20PM.png)

Once `pow` is installed, next we can add our `hello_world` app example.

![](https://cl.ly/1r0h191t0S2B/Screen%20Shot%202017-04-21%20at%202.39.06%20PM.png)

![](https://cl.ly/3z2o1A2T282E/Screen%20Shot%202017-04-21%20at%202.40.28%20PM.png)

Now, point your browser to the app:

http://hello_world.dev

---

#### Optional

One of the best text editors out there is Atom, it works great with Rails projects:

https://atom.io/

---

Also see: [How to Write a Ruby on Rails App for STEEM](https://steemit.com/radiator/@inertia/how-to-write-a-ruby-on-rails-app-for-steem)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 96 others
👎  
properties (23)
post_id2,451,592
authorinertia
permlinkhow-to-configure-your-mac-to-do-ruby-on-rails-development
categoryruby
json_metadata"{"app": "steemit/0.1", "format": "markdown", "links": ["https://www.macports.org/", "https://rvm.io/", "http://localhost:3000/", "https://anvilformac.com", "http://hello_world.dev", "https://atom.io/", "https://steemit.com/radiator/@inertia/how-to-write-a-ruby-on-rails-app-for-steem"], "image": ["https://cl.ly/1L0R0C0v2J16/Screen%20Shot%202017-04-21%20at%202.51.47%20PM.png"], "tags": ["ruby", "rails", "development", "howto"]}"
created2017-04-22 15:58:18
last_update2017-04-22 15:58:18
depth0
children5
net_rshares15,015,967,504,968
last_payout2017-04-29 15:58:18
cashout_time1969-12-31 23:59:59
total_payout_value12.010 SBD
curator_payout_value1.324 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length2,945
author_reputation227,335,189,892,062
root_title"How To Configure Your Mac to do Ruby on Rails Development"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars0
author_curate_reward""
vote details (161)
@raphaelom ·
$0.05
Hey Anthony, why do you prefer ports over brew?
👍  ,
properties (23)
post_id2,452,767
authorraphaelom
permlinkre-inertia-how-to-configure-your-mac-to-do-ruby-on-rails-development-20170422t192530486z
categoryruby
json_metadata"{"app": "steemit/0.1", "tags": ["ruby"]}"
created2017-04-22 19:25:30
last_update2017-04-22 19:25:30
depth1
children1
net_rshares265,521,220,833
last_payout2017-04-29 19:25:30
cashout_time1969-12-31 23:59:59
total_payout_value0.039 SBD
curator_payout_value0.013 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length47
author_reputation242,971,623,482
root_title"How To Configure Your Mac to do Ruby on Rails Development"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@inertia ·
I have nothing against brew.  But most of the things I need are provided by ports.  For example, having multiple versions of Postgres is important for my development process.
👍  
properties (23)
post_id2,452,970
authorinertia
permlinkre-raphaelom-re-inertia-how-to-configure-your-mac-to-do-ruby-on-rails-development-20170422t195148956z
categoryruby
json_metadata"{"app": "steemit/0.1", "tags": ["ruby"]}"
created2017-04-22 19:51:48
last_update2017-04-22 19:51:48
depth2
children0
net_rshares526,223,032
last_payout2017-04-29 19:51:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length174
author_reputation227,335,189,892,062
root_title"How To Configure Your Mac to do Ruby on Rails Development"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@bartcardi ·
These commands aren't working

<i>$ sudo port install gnupg gnupg<i/>

i am using el captain OX for mac ports on my macbook. What am i doing wrong mate?
properties (22)
post_id33,408,718
authorbartcardi
permlinkre-inertia-how-to-configure-your-mac-to-do-ruby-on-rails-development-20180218t021441224z
categoryruby
json_metadata"{"app": "steemit/0.1", "tags": ["ruby"]}"
created2018-02-18 02:14:42
last_update2018-02-18 02:14:42
depth1
children2
net_rshares0
last_payout2018-02-25 02:14:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length152
author_reputation3,940,538,323,363
root_title"How To Configure Your Mac to do Ruby on Rails Development"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@inertia ·
What error are you seeing?
properties (22)
post_id33,409,312
authorinertia
permlinkre-bartcardi-re-inertia-how-to-configure-your-mac-to-do-ruby-on-rails-development-20180218t021830887z
categoryruby
json_metadata"{"app": "steemit/0.1", "tags": ["ruby"]}"
created2018-02-18 02:18:30
last_update2018-02-18 02:18:30
depth2
children1
net_rshares0
last_payout2018-02-25 02:18:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length26
author_reputation227,335,189,892,062
root_title"How To Configure Your Mac to do Ruby on Rails Development"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@bartcardi ·
When i use the commands all of them aren't working why is that? ![Schermafbeelding 2018-02-18 om 05.49.49.png](https://steemitimages.com/DQmSrcjrMhH3vTxctK7bqpfUcpnzvLwnh2CarySBA7RuhWx/Schermafbeelding%202018-02-18%20om%2005.49.49.png)
properties (22)
post_id33,431,412
authorbartcardi
permlinkre-inertia-re-bartcardi-re-inertia-how-to-configure-your-mac-to-do-ruby-on-rails-development-20180218t045006574z
categoryruby
json_metadata"{"app": "steemit/0.1", "image": ["https://steemitimages.com/DQmSrcjrMhH3vTxctK7bqpfUcpnzvLwnh2CarySBA7RuhWx/Schermafbeelding%202018-02-18%20om%2005.49.49.png"], "tags": ["ruby"]}"
created2018-02-18 04:50:06
last_update2018-02-18 04:50:06
depth3
children0
net_rshares0
last_payout2018-02-25 04:50:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length235
author_reputation3,940,538,323,363
root_title"How To Configure Your Mac to do Ruby on Rails Development"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000