This is a guide for installing the contentmine commands to be used within the terminal in Mac OSX; written by a dummy, for dummies.
Hopefully you’ve seen the various guides which have been used in workshops around the UK recently on getting contentmine running within a virtual machine running on your computer. The good news is once contentmine runs on your mac, its as simple to use as it is in the workshops. The bad news is that as an early adopter (on a mac) it’s appears to be slightly trickier to set up than on linux, partially as the existing guides use linux commands which don’t work on a mac without installing other software first. I spent a while figuring out how to best do it on mine, and thought I’d write a quick guide to save others the legwork.
This is split into two halves, as different steps are needed for the two main components of the software. I’ll assume you know basic navigation inside your terminal, if you need to learn then somewhere like here’s a good place to start.
To check if any commands have been installed into your terminal, type into it
Where x is the name of the command. If your terminal returns a path, that means its showing where the command is installed, and so the installation was successful. If you get no result, its not installed in your terminal. This goes both for the contentmine commands that you wish to install, and the commands that you'll need to install to follow this methodology. You never know, you may have some of them installed already.
1-Getpapers and quickscraper
In the tutorials for getpapers and quickscraper the installation is a nice simple line of code using the command npm. This command isn’t preinstalled on macs however, so you’ll need to install it yourself. Theres an easy binary version you can download here. Once this is installed, open a new terminal session and enter the following lines:
npm install --global quickscrape
git clone https://github.com/ContentMine/journal-scrapers.git
npm install --global getpapers
There’s a chance that these commands still won’t work, if so try running the commands preceeded by the word sudo. Sudo just allows you to to execute programs as an administrator, so through use of sudo you can run commands that guests etc aren't allowed to on your computer for security reasons. Enter your password if requested.
This should have installed the commands for use in your terminal!
2-Norma and the AMIs
For normalising the papers into truly usable formats (guide here) and running the AMIs (guide here) things get admittedly a little messier.
Firstly, you need the command wget, which needs to be installed on your mac. Wget can be installed from the download files here.
You then also need to be able to unpackage and install the debian file, which your mac also cannot do out-the-box. This requires you to use the package dpkg, which is a linux command. The only way I found to execute this was to install the programme macports. I’ve seen homebrew recommended as an alternative to macports in some areas, but as it doesn’t allow you to install the files that you unpack, it sadly has no real use here. So macports it is.
Macports requires that you have both Apples XCode Developer Tools and Command Line Developer Tools installed before macports can be used. I’m unsure if they need to be installed prior to installing macports, but figure you may as well do them first to be on the safe side. Both can be downloaded from the Apple Developer site.
After installing them both you need to accept the terms and conditions for XCode, which is simply done by entering the following into your terminal, then following the instructions onscreen:
Once this is all done, then you need to install macports, using the appropriate installer from here.
Now restart your terminal and you should be able to run macports! You need to install the commands you wish to use, in this case its dpkg. For this enter the command below into your terminal, don’t worry if it takes a while to execute
sudo port install dpkg
With these steps completed, you can finally install norma and the AMI files. You’ll need to run
And with all of this finished, you should have the full suite of contentmine software installed on your mac, ready to be used from your terminal. Did I mention the workshop guides on how to use contentmine? They're here, and a good place to start.
Caveat: my coding abilities and knowledge of this kind of stuff is admittedly pretty rudimentary. If anyone has any suggestions for better routes to do any of the above steps/warnings for why one of the steps is a bad idea/corrections for the presumably numerous errors in terminology I’ve made then comment below to inform me and this can be edited. Cheers!