Skip to content

Installing uaparser on Mac OS X

Mikhail Popov edited this page Jul 7, 2017 · 2 revisions

These instructions are for getting the dependencies in place to install uaparser on Mac OS X.

First, this assumes you are using MacPorts and Homebrew. Follow these instructions for installing MacPorts on your Mac.

If you don't have brew yet, the following command (from the Homebrew website) will install it:

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

Boost C++ Libraries

boost libraries are best installed using the Homebrew package manager. To install them, run brew install boost

New Version (for libyaml-cpp 0.5 or newer)

brew install yaml-cpp
devtools::install_github("ua-parser/uap-r")

Should work. May need to brew link --overwrite yaml-cpp if you had the old version of libyaml-cpp installed.

Old Version (for libyaml-cpp 0.3)

If you run sudo port install yaml-cpp or brew install yaml-cpp then you'll install version 0.5+ of yaml-cpp which was not friendly with uaparser until 6 July 2017. What we want is version 0.3.0

The instructions for installing older versions of ports are here but you don't have to read them because I'm going to walk you through this. The latest pre-0.5 revision is this one. You can download the Portfile from a link on the bottom or you can copy and paste the following into text file called Portfile

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$

PortSystem          1.0
PortGroup           cmake 1.0

name                yaml-cpp
version             0.3.0
maintainers         nomaintainer

categories          devel
description         yaml-cpp is a YAML parser and emitter in C++ written around the YAML 1.2 spec
long_description    ${description}

platforms           darwin

homepage            http://code.google.com/p/yaml-cpp/
master_sites        googlecode:yaml-cpp

checksums           md5     9aa519205a543f9372bf4179071c8ac6 \
                    sha1    28766efa95f1b0f697c4b4a1580a9972be7c9c41 \
                    rmd160  0b777f95d858d9e840afa9f92eeffef77eca24b5

worksrcdir          ${name}

Make sure to place this file in a non-protected directory (so NOT in /Users/yourname/Desktop). /tmp totally works! Then run:

cd /tmp
chmod 777 Portfile
sudo port install
# rm Portfile # optional as tmp is emptied on reboot

Linking to yaml-cpp

MacPorts installs everything into /opt/local which is not seen by compilers. There are ways of adding include and lib paths but right now we're going to make the yaml-cpp stuff available by making symbolic links to where the compilers already know to look:

ln -s /opt/local/include/yaml-cpp /usr/local/include/yaml-cpp
ln -s /opt/local/lib/libyaml-cpp.a /usr/local/lib/libyaml-cpp.a

R Packages

First, you need to

install.packages(c("devtools", "Rcpp", "downloader"), repos = c(CRAN = "https://cran.rstudio.com"))

and now you can finally

devtools::install_github("ua-parser/uap-r")