The new main release of Rhodes, RhoElements and RhoConnect had just been released a couple of weeks ago during OSCON. It's now time to install it and start building some mobile apps!
In this post I'd like to help you installing RMSv5.0 on a new OS X Mavericks machine and install everything that is needed to build iOS and Android applications, the only pre-requisite is to have a valid OS X Mavericks license installed on a Mac or inside a virtual machine… on a Mac :-).
These are the steps we will follow:
- Update OS X to the latest version
- Install XCode
- Familiarize with the terminal
- Instal Java JDK7
- Install HomeBrew
- Install RVM and Ruby 1.9.3
- Install git, node and other little utilities
- Install Android SDK and NDK
- Install RMS v5.0
- Create a RhoMobile.com account
- Launching RhoStudio
- RhoStudio Setup
- Build your first RhoMobile application
The first step is to check that the version of OS X on your machine is up-to-date, a quick stop in the Mac AppStore Updates tab can give you an idea of what is available.
The next step is to install the latest XCode on you OS. In this guide I'm using XCode 5 as version 6 is still in beta, and we like stable releases!
Once you've installed XCode, you need to launch it to accept Apple EULA.
During the initial RMS setup some of the steps require that you use the Terminal, also known as command prompt or console. The Terminal is already avaialable on OS X, and you can find it inside the Utility folder in your Applications.
Once you've launched the Terminal could be very useful to keep it into the dock, as we will need it for some of the steps to complete RMS setup.
OS X Mavericks comes without any Java environment installed, "the easiest way" to install it, is to open the terminal and type:
This will popup a windows asking if you want to install Java, the answer is a resounding YES!
Selecting More Info… will open the Safari browser on the Oracle website, you can select the most up-to-date JDK v7 for OS X to download
When the install is complete you can test that the java environment is now available:
HomeBrew is an opensource package manager, working from the command line, that help setting up opensource application on OS X.
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Paste that at the terminal prompt, execute it and follow the on-screen instruction accepting all the defaults. Next step is to check that HomeBrew is setup correctly:
If everything is setup correctly you get the message: Your system is ready to brew:
If you get a different message with some missing or misconfigured software you can follow the on-screen-instruction or you can find further informations on the HomeBrew Wiki.
OS X Mavericks comes with Ruby v2.0 installed by default, however RMSv5 requires Ruby v1.9.3. Overall working with Ruby can require to switch ruby environment often and to release this pain some utilities has been created.
In this case we're going to install RVM and use it to install Ruby v1.9.3. First we need to install some prerequisite using HomeBrew:
brew tap homebrew/versions brew install gcc46 brew cleanup brew doctor
then install RVM itself together with ruby 1.9.3:
\curl -sSL https://get.rvm.io | bash -s stable --ruby=1.9.3
Then you need to close the terminal and relaunch it to ave the RVM environment available in the command line.
To check that everything is setup correctly you can do:
and you should get the reply:
rhomobile$ rvm list rvm rubies =* ruby-1.9.3-p547 [ x86_64 ] # => - current # =* - current && default # * - default
In this case Ruby v1.9.3 is the current and default ruby environment. If this is not the case, you can set it up as the default ruby using the command:
rvm alias create default 1.9.3
To get more information on RVM you can check the documentation available on its website.
RMS uses git a lot, to sync projects with RhoHub, and is overall a nice tool. It's already installed on Mavericks, but is version 184.108.40.206, better to keep an up-to-date version using HomeBrew:
brew install git git --version
This will install git v2.0.4 (at the moment of writing this).
If asking to the system for the installed git version still report 220.127.116.11:
git --version git version 18.104.22.168 (Apple Git-48)
Then you need to modify the PATH environment as suggested using the command:
rhomobile$ brew doctor Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry and just ignore them. Thanks! Warning: /usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. The following tools exist at both paths: git git-cvsserver git-receive-pack git-shell git-upload-archive git-upload-pack Consider setting your PATH so that /usr/local/bin occurs before /usr/bin. Here is a one-liner: echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile
So, using the command:
echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile
Solve the issue (after closing and restarting the Terminal).
brew install node
The Latest application we need to support RhoConnect is Redis, again we can use HomeBrew to install it:
brew install redis
Then we can install at least one command line utility that can be very handy looking for "stuffs" inside source codes: The Silver Searcher:
brew install the_silver_searcher man ag
As always, using man in the command line will open the documentation for the command, in the case of the silver searcher, the command is ag (like the Silver simbol).
Next step is to install what is needed to build RhoMobile Android Applications. You need to remember that to compile RhoMobile native applications you need to have the target OS toolchain. For Android this means the SDK and the NDK.
Navigate to the Android developer tools page and download the stand-alone Android SDK tools for Mac:
When the download is complete you can install the SDK in the Development folder, again from the command line:
cd ~/Downloads/ mkdir ~/Development unzip android-sdk_r23.0.2-macosx.zip -d ~/Development/
This will create android-sdk-macosx under your home folder. To add the sdk to your PATH, use the command:
echo export PATH='$PATH:~/Development/android-sdk-macosx/tools' >> ~/.bash_profile
closing and relaunching the Terminal will make this new PATH available. You can now launch the Android SDK manager using the command:
And install the latest platform tools and the Platform SDK (not shown in the image is the Android Support Library that is always nice to have installed):
Once you've installed these packages, you can close the Android SDK Manager and add the now available platform tools folder to your PATH:
echo export PATH='$PATH:~/Development/android-sdk-macosx/platform-tools' >> ~/.bash_profile
closing and relaunching the Terminal will make this new PATH available. You can now launch the Android Debug Bridge using the command:
If you plan to develop using Motorola Solutions (or Symbol) Android devices, you need to modify an Android configuration file:
rhomobile$ android update adb adb has been updated. You must restart adb with the following commands adb kill-server adb start-server echo -e "0x05e0\n0x0414" >> ~/.android/adb_usb.ini
Now attaching your device you can see it with:
adb kill-server adb devices
cd ~/Development/ tar xzvf ~/Downloads/android-ndk32-r10-darwin-x86_64.tar.bz2
For this step we can take the info from the RhoMobile official documentation.
first of all we need to download the RMS5 image file from RhoMobile website. Opening the image will show it's content, first step is to copy the Motorola RhoStudio in the application folder:
Then we've some additional steps to do from the Terminal… yes, again from the command line :-)
NOTE I previously used sudo at this step and this produce a series of side effects. Just be sure to run the "Install gems" script with your user!
cd /Volumes/Motorola\ RhoMobile\ Suite\ Installer/ ./Install\ gems Select Ruby version to install gems: 1) ruby-1.9.3-p547 2) ruby-1.9.3-p547@global #? 2 Using /Users/rhomobile/.rvm/gems/ruby-1.9.3-p547 with gemset global ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-darwin13.3.0] Do you want to install gems with 'sudo' command prefix? [yN] N
When the gems setup is complete, you can install the support for RhoConnect Push server:
cd /Volumes/Motorola\ RhoMobile\ Suite\ Installer/ sudo ./Install\ rhoconnect-push Password: Do you want to install rhoconnect-push with 'sudo' command prefix? [Yn] Y
Version 5 of the RhoMobile Suite has a new licensing, that is a yearly subscription available in different levels, starting from a free one, up to an Enterprise grade.
Whatever the level you choose, you need to create an account on the RhoMobile.com website to use the Suite, both from RhoStudio and from the command line tools.
RhoStudio and the whole RhoMobile Suite is now installed on your Mac, but you still need some steps to finish the configuration and start doing some coding. First of all launch RhoStudio from the Application folder (launch the 64-bit version) and select the second ruby environment for it.
At this moment you will get a request to install a J6SE environment, go ahead and install it (the JDK we installed is for the Android SDK, this is used to run Eclipse)
Finally we've RhoStudio running, we need to configure it!
BTW: if the first launch ends with and error in RhoStudio console, simply close it and relaunch RhoStudio again, you end up with a login request, simply use the RhoMobile account you created at the previous step.
There're some parameters to setup in RhoStudio before being able to build any project. Opening the settings windows using Command-, you can setup:
- JDK Path = /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk
- Android SDK Path = /Development/android-sdk-macosx
- Android NDK Path = /Development/android-ndk-r10
as shown in these images:
Another (easier?) way to configure Rhodes is doing it from the command line:
rhodes-setup We will ask you a few questions below about your dev environment. JDK path (required) (/Library/Java/Home): Android SDK path (blank to skip) (): /Users/rhomobile/Development/android-sdk-macosx/ Android NDK path (blank to skip) (/Users/rhomobile/Development/android-ndk-r10): Windows Mobile 6 SDK CabWiz (blank to skip) (): BlackBerry JDE 4.6 (blank to skip) (): BlackBerry JDE 4.6 MDS (blank to skip) (): BlackBerry JDE 4.2 (blank to skip) (): BlackBerry JDE 4.2 MDS (blank to skip) (): If you want to build with other BlackBerry SDK versions edit: /Users/rhomobile/.rvm/gems/ruby-1.9.3-p547@global/gems/rhodes-5.0.2/rhobuild.yml
I'll cut this short at this moment, you should have everything setup at this moment and you should be able to follow the instructions on RhoMobile website. You can reach out to me if you've any question and I plan to add another post with some "post-setup" optimization in the near future.