Month: February 2015
From start to finish: Install Ruby on Rails on OSX, Deploy on Heroku
Ruby on Rails is one of the most popular web development frameworks, and Heroku has become a popular place to quickly deploy applications – and both for very good reason. For this guide, you will need a Heroku account (it’s free to sign up). This guide also assumes that you’re running OSX 10.10. Beyond those two assumptions we will try to go from ground zero to have a local rails development environment and an environment on Heroku.
Tools:
- 1 ea OSX 10.10
- 1 ea Heroku Account
- 1 ea Ruby 2.0
- 1 ea Rails 4.2
- 1 ea RVM
- 1 ea git
- 1 ea xcode
1Install Xcode
If Xcode is already installed, you can skip this step. To check, open your Terminal application and type:
xcode-select -p
If Xcode is installed you will see the path in the Applications directory:
/Applications/Xcode.app/Contents/Developer
If it’s not installed type:
xcode-select --install
and you will be prompted to install the Xcode Command Line Tools.
After installing, verify the install:
$ xcode-select -p /Applications/Xcode.app/Contents/Developer
and finally ensure gcc is installed:
$ gcc --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin14.1.0 Thread model: posix
2Configure git
Git is a popular version control software, and it will be required to push to Heroku in later steps. If you’ve successfully installed Xcode, git will be installed as well. You can go ahead and configure git now.
First, you can confirm that git is installed:
$ git --version git version 1.8.3.4 (Apple Git-47)
and now configure it by typing:
$ git config --global user.name "Your Real Name" $ git config --global user.email me@example.com $ git config -l --global user.name=Your Real Name user.email=me@example.com
The above commands will set your name and your email address. Then the third line simply checks to make sure they were set properly. These values will be used to identify your commits.
3Install Homebrew
Homebrew is a popular package manager for OSX. There are other great package managers, but for this guide we will use homebrew.
To install type:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
4Install RVM
RVM is the ruby version manager. This allows you to have multiple ruby environments on the same machine. You may not need multiple environments, but it’s the easiest way to setup the environment you need for this guide.
To install type:
curl -L https://get.rvm.io | bash -s stable --ruby
The –ruby flag installs the latest version of ruby.
5Check RubyGems version
RubyGems should be installed, but you can check the version with this:
$ gem -v 2.4.6
and update if necessary:
$ gem update --system
To check which gems are installed in the global gemset, use:
$ rvm gemset use global $ gem list
This will list your gems, and if you’d like you can update any stale gems:
gem update
I also recommend using the following the speed up gem installation by disabling documentation:
$ echo "gem: --no-document" >> ~/.gemrc
Lastly, we should install Nokogiri in the global gemset. Many gems, including rails, depend on Nokogiri.
$ gem install nokogiri
6Install rails
For this guide, we will create a new gemset to install for this specific version of rails. You could skip this command and by default you would be installing rails in the global gemset.
To make a gemset for the current stable release type:
$ rvm use ruby-2.2.0@rails4.2 --create
At the time of this writing, rails 4.2 is the current version. If a new version is out you can name the gemset it appropriately.
Use the following to install the latest version of rails:
$ gem install rails
After it finishes installing, check that rails is installed:
$ rails -v
7Create a folder for your project
I typically keep all of my development projects in ~/Developer, but you can organize your projects however you’d like.
To follow my example, let’s create the Developer folder as well as our specific project folder:
$ mkdir -p ~/Developer/my_rails_project
8Get an account on Heroku
At this point, we’re going to switch gears. You could skip straight to creating your rails app and worry about this step later if you’d like, but I think this is the most logical point to get your heroku environment setup.
As mentioned in the guide description, you’ll need to set up an account on Heroku. It’s free to sign up, so go ahead and do that if you haven’t already. Make sure to remember your login information.
9Install the Heroku toolbelt
Install the Heroku Toolbelt. This gives you access to the Heroku command line tools, which allow you to deployment your project files to your Heroku environment which we will do in subsequent steps.
10Log in to Heroku
With the Heroku Toolbelt installed, go ahead and log in to Heroku in your console. To do this type:
$ heroku login
You will be prompted to enter your email address and password.
11Install and configure Postgres
Heroku requires postgres so we will use postgress in our development environment as well. We’ll install using homebrew, like this:
$ brew install postgres
Then run this command to finish installing the database:
$ initdb /usr/local/var/postgres
Run the following commands to start postgres upon login:
$ mkdir -p ~/Library/LaunchAgents $ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Now, you can install the postgres gem that will be required for your rails application:
$ gem install pg
12Create your rails app
If you followed my example for setting up your project folders you can cd into your project folder like this:
cd ~/Developer/my_rails_project
From within your project folder, you can create your rails app like this:
rails new . --database=postgresql
Next, we should make sure all necessary gems are installed. The following command will check and install all gems in your Gemfile. So if you install a gem on your local environment, you need to add it to your Gemfile as well. While developing, you’ll find that many bugs can be fixed by either making sure your Gemfile is up to date or simply running the following command.
$ bundle install
13Configure your local database
Rails makes this part easy. Once you’ve got your rails app created simply run the following two commands from the command line:
$ rake db:create:all $ rake db:migrate
14Now let’s test our local environment
We should be setup and ready to start developing, but first let’s test our local environment.
From your project root, run:
$ rails server
This will create a local webserver running your rails application. To visit see your app, go to http://localhost:3000 in a web browser.
You should see the Rails welcome page.

15Deploy the app to heroku
Now that we’ve got a working – although quite boring – rails application, we can go ahead and push our code to Heroku. You might decide in the future to build out your application a little more before deploying, but for this guide we will just deploy our bare application so you can get familiar with the process.
First we’ll want to initialize this application in git.
$ git init $ git add . $ git commit -m "init"
This initializes, adds all of the code, and creates your first commit message.
Now we’ll create our heroku application. This can also be done from the Heroku website, but we’ll do it here for simplicity.
$ heroku create
Now verify that the remote app was created:
$ git config --list | grep heroku remote.heroku.url=https://git.heroku.com/simpleregistry.git remote.heroku.fetch=+refs/heads/*:refs/remotes/heroku/*
Now we can deploy our code:
$ git push heroku master
16Test our heroku environment
We’ll want to view our application on Heroku, even if it doesn’t do anything interesting.
So first we’ll make sure we have one dyno running the web process:
$ heroku ps:scale web=1
And double check that the process is running:
$ heroku ps === web (1X): `bin/rails server -p $PORT -e $RAILS_ENV` web.1: up 2015/02/23 09:06:08 (~ 1m ago)
Now, let’s check out our application in the browser!
$ heroku open
This will open up a new browser tab to view your application on heroku. Since this is the production environment, we won’t get any error messages or the rails test page. It will simply 404 since we haven’t set up any routes or controllers. But at least we know it’s working.
Now you can start writing your rails application and future deployments can be achieved through the command we used initially:
$ git push heroku master

17Further reading
If you found any issues with this guide, please report them. I’m hoping this can serve as a great guide for beginners and a reference for more experienced developers.
Install Ruby on Rails on Mac OS X
http://railsapps.github.io/installrubyonrails-mac.html
Getting started with rails 4.x on Heroku
https://devcenter.heroku.com/articles/getting-started-with-rails4
Installing Postgres on Mac OSX
http://www.gotealeaf.com/blog/how-to-install-postgresql-on-a-mac
Getting started with Rails
Now learn about:
Discuss this guide
Tools:
- 1 ea OSX 10.10
- 1 ea Heroku Account
- 1 ea Ruby 2.0
- 1 ea Rails 4.2
- 1 ea RVM
- 1 ea git
- 1 ea xcode
Join Us
How to generate a secure, random password
Most people use the same password for every account they have on the Internet. This is highly insecure for obvious reasons. For important accounts that you need to keep protected it’s a good idea to generate a random secure password.
1Generate a random password
There are plenty of tools across the internet that will help you generate random passwords. I recommend using a password manager, and many password managers come with a password generator built in. These are generally reliable for creating secure passwords. As a guide, an 8 character random password usually takes a few days to crack whereas a 10 character password takes years. Obviously the more characters you use the more secure the password assuming it is completely random.
2Test the security
Once you generate your password you can go to howsecureismypassword.net. Simply enter your password, and it will let you know how long it takes a normal desktop computer to crack it!
Now learn about:
Discuss this guide
Join Us
How to adjust your Hario Mini Mill coffee grinder
The Hario Mini Mill grinder makes an affordable, high quality coffee grinder if you set it up properly. Unfortunately, the directions are not very clear as to how to adjust for the perfect grind.
1Screw adjustment nut all the way down
Remove the bottom canister and screw the adjustment nut as tight as it goes. This serves as a reference for the next step.

2Unscrew the adjustment nut to the proper setting
The way to measure your grind is by “clicks” away from all the way tight. You’ll feel the nut click as you unscrew, so count the number of clicks. The number of clicks to unscrew should vary based on the brew method you’re using. Here’s the general guide I use: Standard Drip Brew: 10 clicks #2 Pour over: 10 clicks Aeropress: 6-8 clicks Espresso: 5 clicks French Press: 12-14 clicks Moka pot: 9 clicks Chemex: 9 clicks
Also if you’re looking for the more vague ones: Medium fine: 8 clicks Medium: 10 clicks Medium coarse: 12 clicks
credit to u/Iwannayoyo for the vague ones

3Follow this chart for options not listed

Now learn about:
Discuss this guide
Join Us
How to flush dns on Mac OS 10.7 or 10.8
Flushing your dns is a very useful troubleshooting step and is necessary for some network changes to take effect. For some reason, Apple likes to change the command to clear the dns cache with just about every OS update, so here is the old command.
1Open Terminal
This is located in Applications > Utilities
2Execute the following command
sudo killall -HUP mDNSResponder
Now learn about:
Discuss this guide
Join Us
Since the UI has changed, there is literally no way to manage your balance manager, or the way that paypal decided when to take money from your account.
Since the UI has changed, there is literally no way to manage your balance manager, or the way that paypal decided when to take money from your account.
Since the UI has changed, there is literally no way to manage your balance manager, or the way that paypal decided when to take money from your account.
Since the UI has changed, there is literally no way to manage your balance manager, or the way that paypal decided when to take money from your account.
How to access the balance manager in the new Paypal UI
paypalfinanceMake sure you’re logged into your paypal account
Go to this link
Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.


Flushing your dns is a very useful troubleshooting step and is necessary for some network changes to take effect. For some reason, Apple likes to change the command to clear the dns cache with just about every OS update, so here is the old command.
This is located in Applications > Utilities
sudo killall -HUP mDNSResponder


Flushing your dns is a very useful troubleshooting step and is necessary for some network changes to take effect. For some reason, Apple likes to change the command to clear the dns cache with just about every OS update, so here is the old command.
This is located in Applications > Utilities
sudo killall -HUP mDNSResponder


Flushing your dns is a very useful troubleshooting step and is necessary for some network changes to take effect. For some reason, Apple likes to change the command to clear the dns cache with just about every OS update, so here is the old command.
This is located in Applications > Utilities
sudo killall -HUP mDNSResponder


Flushing your dns is a very useful troubleshooting step and is necessary for some network changes to take effect. For some reason, Apple likes to change the command to clear the dns cache with just about every OS update, so here is the old command.
How to flush dns on Mac OS 10.7 or 10.8
osxmacThis is located in Applications > Utilities
sudo killall -HUP mDNSResponder
This is located in Applications > Utilities
This is located in Applications > Utilities
Open Terminal
sudo killall -HUP mDNSResponder
sudo killall -HUP mDNSResponder
Execute the following command




Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.
Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.
Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.