Skip to content
Chris Lasell edited this page Jul 5, 2021 · 17 revisions

Hands On, Real-time Classic API Using ruby-jss

Jamf Nation User Conference 2019, Hyatt Regency Minneapolis

Interactive Lab, Thursday, Nov. 14, 10:15am, Regency Room

(Home)

Prepare for Attending the Lab


tl;dr

sudo gem install ruby-jss --bindir /usr/local/bin

or if you already have ruby-jss installed:

sudo gem update ruby-jss --bindir /usr/local/bin

If you plan on attending the lab, please do the following before you arrive. Doing so will allow more time for learning about ruby-jss itself.

IMPORTANT Please make sure you have installed ruby-jss version 1.2.1 or higher. It contains fixes for some bugs discovered while creating this lab!

Introduce yourself to ruby

If you don't use ruby very much, familiarizing yourself with the language before the lab may be useful. Ruby isn't difficult to learn, especially if you are familiar with Python or JavaScript.

Ruby is (for now) already installed on every Mac as part of the OS. You'll find it at /usr/bin/ruby.

Along with ruby, you'll find irb, short for 'Interactive Ruby', a repl that allows you to run ruby code and see the results in realtime. We'll be using irb for most of the lab.

The Links and Resources page lists some useful online tutorials and ruby references to get you started with ruby and irb.

Particularly appropriate for this lab, my JNUC 2016 presentation 'Alleviating the Apprehension of Coding in Ruby' is available online. That presentation was an introduction to the ruby language, while this lab is more focused on ruby-jss itself.

You're also welcome to join the #ruby channel in the worldwide MacAdmins Slack Workspace where you can ask questions and learn more about ruby from those who use it.

Install or update ruby-jss

Along with ruby itself, macOS currently has the gem command pre-installed. Gems are ruby software packages, and gem is the command for installing, updating and maintaining them. Thousands are available at rubygems.org, which is where they are downloaded from by default.

To install ruby-jss, just run this command in a terminal window in an admin account on your Mac:

sudo gem install ruby-jss --bindir /usr/local/bin

If you already have ruby-jss installed, please update it:

sudo gem update ruby-jss --bindir /usr/local/bin

IMPORTANT Please make sure you have installed ruby-jss version 1.2.0 or higher. It contains fixes for some bugs discovered while creating this lab!

the --bindir is needed because by default, gem install will try to put executables into /usr/bin, which is protected by SIP on macOS and will cause an error.

If you don't have the folder /usr/local/bin, create it first using mkdir -p /usr/local/bin

It will install ruby-jss, and several other gems that ruby-jss needs, into the default gem folder /Library/Ruby/Gems/<ruby-version>/.

For mac0S 10.13 & 10.14, the ruby version is 2.3, older macOS will have ruby 2.0, and 10.15 has ruby 2.6.

To confirm that its installed and working, run this in a terminal:

ruby -r ruby-jss -e 'puts JSS::VERSION'

You should see the version number displayed.

Clone this wiki locally