How to prepare your Linux/MacOS box for Ionic 3 development

Stavros Kounis
Appseed IO
Published in
4 min readMay 4, 2018

The guide assumes the OS of your machine is High Sierra 10.13.3 for Mac users and Ubuntu 16.04 for Linux users. If a Linux distribution is used, please skip the iOS section and continue to the Android section.

Install NodeJS

Download and install the latest LTS NodeJS from the following link:

Note: At the time this guide was written, the latest LTS version of NodeJS was 8.10.0.

Install CLIs

To install the global dependencies run:

$ npm install -g ionic cordova

Note: This command will install the latest version of Ionic and Cordova. At the time this guide was written, the latest version of Ionic was 3.20.0 and Cordova was 7.1.0.

SDK environment for iOS and Android platforms

To be ready to add and build the iOS and Android platforms, follow the steps below.

iOS

The iOS platform can be added on MacOS only. If you do not use MacOS, please skip this step and continue to the Android section.

Install Xcode

Visit:

and install the latest Xcode version.

Install CocoaPods

From your terminal, execute the following command to install the latest version of CocoaPods.

$ sudo gem install cocoapods

Enable command-line tools

Once Xcode is installed, several command-line tools need to be enabled for Cordova to run. From your terminal, run:

$ xcode-select — install

For more information on the iOS requirements, visit:

Android

Install Java SE Development Kit 8 (JDK)

Visit Oracle’s website and install Java SE Development Kit 8.

Install Android Studio 3.x

Visit Android’s Studio page and install Android Studio 3.x.

Linux Users only

If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries. To determine what version of Linux is installed, open your terminal, type the following command at the prompt, and then hit Enter:

$ lscpu

The “CPU op-mode(s)” entry tells you what version of Linux you’re running. If your running a 32-bit version of Linux you’ll see only a 32-bit mode listed and you can stop reading here. If you running a 64-bit version, you’ll see both the 32-bit and 64-bit modes listed since a 64-bit processor can run both. In that case you need to install the following 32-bit libraries. From your terminal, execute the command:

$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2–1.0:i386

Install SDK Platforms

After installing the Android SDK, you must also install the packages for whatever API level you wish to target. To do it, open the Android Studio, and click on Configure -> SDK Manager.

Then, from the side menu, select Appearance & Behavior -> System Settings -> Android SDK click on the SDK Platforms tab and select one or more versions of APIs to download, as shown:

Install Android Support Repository

Usually, Android Support Repository is already configured once you install Android Studio. If it’s not, go to tools -> SDK Manager from the menu and on the SDK Tools tab select to install the Android Support Repository.

Install Gradle

Sometimes, you may need to install gradle manually. To determine if Gradle is installed, open the Android Studio, and click on Configure -> Plugins.

Choose Enabled from Show and search for the Gradle plugin in the list.

If you can’t find the Gradle plugin you have to install it as directed at:

Note: Following the instructions of the aforementioned link, the latest Gradle distribution will be installed on your machine. At the time this guide was written, the installed Gradle version was 4.6.

For more information on the Android requirements, visit:

Set environment variables

MacOS

On a Mac, you can use a text editor to create or modify the ~/.profile file. To set an environment variable, add a line that uses export like so and substitute the path with your local installation:

export ANDROID_HOME=/Users/YOUR_USER_NAME/Library/Android/sdkexport JAVA_HOME=/usr/libexec/java_home

Linux

On a Linux, you can use a text editor to create or modify the ~/.bashrc file. To set an environment variable, add a line that uses export like so and substitute the path with your local installation:

export ANDROID_HOME=/home/YOUR_USER_NAME/Android/Sdkexport JAVA_HOME=/opt/java/jdk1.8.0_162/

Sass

To install Sass open your terminal and execute the following command:

$ npm install -g sass

For more information visit Sass site.

References

Install Android Studio guide, iOS Platform Guide, Android Platform Guide, Gradle installation docs.

Originally published at AppSeed’s blog.

--

--

Stavros Kounis
Appseed IO

Software developer and Javascript enthusiast, passioned with web and mobile technologies, skounis.github.io