Content > Coding Tutorial for MAC Users: Get Started!

Coding Tutorial for MAC Users: Get Started!

Jul 14, 2019

 

 

Hello there, you cool individual that found this blog,

 

We are Purple Polar Bear, a software company based in the Netherlands (in case you didn't already know, we dutchies are awesome!). Our business is coding and development, either for our own products or services that we want to release, or building digital products & services for our clients. Due to the increasing interest of people wanting to learn how to code, we think it is our responsibility to help the masses by creating an easy-to-follow blog and vlog series explaining how to create your first web application. These tutorials are for MAC users. 

 

Web-app / web-application: A program (application) which runs in a web browser. Think of any online sales sites you have visited, platforms you are active on or even your email that you check via safari or chrome.   

 

Blog Series:

In this blog series, we are going to teach you how to take the first steps to become a developer. Together, we are going to build your very first web-application and we, the great Purple Polar Bear team, are going to help you with every step of the way. 

 

Please follow our blog posts in the correct order so that you do not miss a step or insight that might be important to do everything the right way. Another important thing to note is that the original Vlogs and Blogs were originally done in Dutch which means that when viewing the vlogs, you will notice that the video is in Dutch (with English transcripts, of course)… Before you panic, you are not required to know even the smallest amount of Dutch to get through this.

 

You can view our channel by clicking on this link: https://www.youtube.com/channel/UCvv0Jos2BZlFcnsF3kfAN-w   

 

Or view the vlog directly:

Getting Started:

 

The first step to becoming a developer, or building your own web-application, is making sure that you have the right tools to build. You can't build a house without the right tools, just like you cannot build an app without the right tools. 

 

That is where our first blog will start, getting you set up so that you can start building your own awesome web-app which is also mobile friendly.

 

What do you need, you ask?

 

Your Macbook and an internet connection. That is it! Nothing that we are going to show you will cost you a cent. You just need to follow our instructions and along the way, you will be learning.

 

So let's get this started. 

 

Ruby on Rails

Purple Polar Bear likes to develop in Ruby on Rails. There are a number of different coding languages that you can choose to develop with, each with their own pros and cons, but this tutorial series will revolve around the language Ruby and the framework, rails (ruby on rails).

 

To find out more about the different languages and what they can be used for, please read the following article., which does a good job in explaining the differences, advantages and the uses of the more common coding languages.

 

https://mikkegoes.com/14-programming-languages-explained/  

 

 

So let's start with setting up your ruby. First things first. We are going to work a lot with the terminal. Through your terminal, you are able to communicate with your computer easily.

 

You can open the terminal on your Mac by clicking command [cmd] + [space bar].

 

Then you can type “terminal” in the search field and press enter. Voilà, your terminal will appear! Now we are going to install Ruby.

 

To install Ruby, Mac has a great program that will allow you to do so easily. This is called Homebrew. Homebrew is a software package management system that simplifies the installation of software on Apple's macOS operating system and Linux.

 

No Mac, no Homebrew!

 

Go to https://brew.sh  

 

On the Homebrew website, you will see the heading “Install”. Copy the text found below that heading and paste that into your terminal (also seen below).

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

--------------------------------------------------------------------------------------------------------------------------------------------------------

 

After pasting, Homebrew starts installing immediately. Your terminal will then ask - “Press RETURN to continue or any other key”. Please press enter and enter the password for your computer to continue.

 

Please note: Homebrew may take several minutes to install.

 

Boomerdebangbang! Homebrew is installed!

 

 

NEXT: Install rbenv:

 

The next step to getting you set up for success is to install rbenv.

rbenv is a tool that lets you install and run multiple versions of Ruby side-by-side so that your computer can easily switch between different Ruby versions.

 

Go back to the terminal and type in the following:

--------------------------------------------------------------------------------------------------------------------------------------------------------

 brew install rbenv ruby-build

--------------------------------------------------------------------------------------------------------------------------------------------------------

Press enter

 

 

Now that this is installed, we have to tell the terminal how it can find rbenv. We do this by adding the three commands to your terminal. Each command is different so do make sure to press enter before entering the next command.  

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

echo ‘export PATH=”$HOME/.rbenv/bin:$PATH”’ >> ~/.bash.profile

--------------------------------------------------------------------------------------------------------------------------------------------------------

Press enter

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

echo ‘if which rbenv > /dev/null; then eval “$(rbenv init -)”; fi’ >> ~/.bash_profile

--------------------------------------------------------------------------------------------------------------------------------------------------------

Press enter

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

Source ~/.bash_profile

--------------------------------------------------------------------------------------------------------------------------------------------------------

Press enter

 

 

After adding the last provided command, close your terminal and open it again so that we can install Ruby.

 

Installing Ruby:

 

Now we can finally install Ruby itself. It is always important to install the latest and most stable version (step 1) and set it as the standard version for your computer (step 2).

 

Step 1 – Ruby                            

 

Type the following in your terminal:

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

rbenv install 2.5.3

--------------------------------------------------------------------------------------------------------------------------------------------------------

Press enter

 

 

Please Note: At the time you are reading this, there could very well be a new version of ruby. It is always a good idea to download the latest version, as there will be new patches, security upgrades, and new functionality.

 

To check which version is the latest one, go to: 

https://www.ruby-lang.org/en/downloads/releases/

 

You will see a list of all the latest versions. Do not download any list version if the version title includes "preview", "beta", "alpha", or "rc". 

 

Step 2 – Setting Ruby version as your default.

 

Type in:                            

--------------------------------------------------------------------------------------------------------------------------------------------------------

rbenv global 2.5.3

--------------------------------------------------------------------------------------------------------------------------------------------------------

Press enter

 

 

Congrats! If you followed the instructions, you should have Ruby!

 

 

                                                                                       

 

 

Without taking your word for it, we can check if the steps you took worked. Let’s check if its there. Type the following into your terminal:

 

--------------------------------------------------------------------------------------------------------------------------------------------------------

ruby -v

--------------------------------------------------------------------------------------------------------------------------------------------------------

Press enter

 

Do you now see 2.5.3 appear? If so, awesome 😊 please continue to the next step – Installing Rails. If not, please see where you may have missed something above and try again!

 

 

Installing Rails

 

Ruby works with small software packages called gems. We are now going to install the Rails gem. Installing Rails may also take some time.

 

To install rails, type the following into your terminal:

--------------------------------------------------------------------------------------------------------------------------------------------------------

gem install rails -v 5.2.1

--------------------------------------------------------------------------------------------------------------------------------------------------------

Press enter

 

Just like with ruby, it is important to make sure that you have downloaded the latest version of rails. To find out which is the latest version of ruby, go to: 

 https://rubygems.org/gems/rails/versions

 

Again, do not download any list version if the version title includes "preview", "beta", "alpha", or "rc". 

 

 

Now that you have installed rails, we need to refresh rbenv so that it can actually see your version of rails. To refresh rbenv type the following in your terminal:

--------------------------------------------------------------------------------------------------------------------------------------------------------

rails -v

--------------------------------------------------------------------------------------------------------------------------------------------------------

Press enter

 

Do you now also see “Rails 5.2.1”? Well done! You have got through the first blog unscathed. This means that you have taken a big step towards learning how to develop your own web app. Just in case you needed a slight refresher for what steps were taken, we have provided a recap for you below. 

 

Blog Recap:

  1. We found and opened your terminal
  2. Homebrew was installed so that you can install cool software to help you code
  3. Then we installed rbenv which now allows us to install Ruby & the gem Rails
  4. Installed Ruby
  5. Installed Rails

 

That was it for the first blog in our blog series. Now the basics are in place. In our next vlog, we will explain how you can start building your very first web-application 😊

 

Meer?

Abonneer je op ons Youtube kanaal! Dan krijg je een notificatie op het moment dat we een nieuwe vlog lanceren :-)


© 2019 - 2024 Purple Polar Bear.
All rights reserved

Purple Polar Bear

Purple Polar Bear B.V. | hello@purplepolarbear.nl | KvK: 70930899 | BTW: NL858515283B01