Skip to content

Instantly share code, notes, and snippets.

@bitjockey42
Created January 11, 2014 08:17
Show Gist options
  • Save bitjockey42/8368377 to your computer and use it in GitHub Desktop.
Save bitjockey42/8368377 to your computer and use it in GitHub Desktop.

Table of Contents

1 Mopidy on OS X {#sec-1}

1.1 Pre-Requisites {#sec-1-1}

  • XQuartz 2.7.5
  • gst-python010
  • gst-plugins-good010
  • gst-plugins-ugly010
  • libspotify

1.2 Installing the pre-requisites above {#sec-1-2}

I am following the instructions laid out here since there were some issues.

You need to tap homebrew/versions to get this all to install.

brew tap homebrew/versions
brew install gst-plugins-base010 --with-libogg --with-theora --with-libvorbis
brew install gst-plugins-good010 --with-flac --with-taglib --with-libsoup --with-jpeg --with-libcaca --with-libshout --with-speex
brew install gst-plugins-bad010 --with-faad2 --with-libsndfile --with-libmms
brew install gst-plugins-ugly010 --with-mad --with-libvorbis --with-lame --with-two-lame --with-flac --with-theora --with-libmms
brew install imagemagick gst-python010 libspotify

1.2.1 gst-plugins-good010 fails to install {#sec-1-2-1}

For some reason, gst-plugins-good does not build successfully without doing the steps below.

So you must edit the formula to include a dependency on cairo.

brew edit gst-plugins-good010

This will open up the $EDITOR. At the time of this writing, it's been set to emacs.

In the editor, find the line:

depends_on 'gettext'

Below, this, add:

depends_on 'cairo'

Save the file.

1.3 Installing mopidy {#sec-1-3}

You must have set PYTHONPATH in .zprofile/.zshrc/.bashrc/.bash_profile:

export PYTHONPATH=$(brew --prefix)/lib/python2.7/site-packages:$PYTHONPATH

Then, install with pip:

sudo pip install -U pyspotify pylast cherrypy ws4py mopidy

1.4 Configuring mopidy {#sec-1-4}

An example mopidy config (found in $HOME/.config/mopidy/mopidy.conf):

[mpd]
hostname = ::

[spotify]
username = alice
password = mysecret

1.5 Running mopidy as a daemon {#sec-1-5}

On OS X, launchd loads agents (also called daemons).

launchctl is the commandline interface for launchd.

To start mopidy as a daemon, create a file in $HOME/Library/LaunchAgents/com.mopidy.server.plist (copied from this):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.mopidy.server</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/mopidy</string>
  </array>
  <key>EnvironmentVariables</key>
  <dict>
    <key>PYTHONPATH</key>
    <string>/usr/local/lib/python2.7/site-packages</string>
  </dict>
  <key>RunAtLoad</key>
  <true/>
  <key>KeepAlive</key>
  <true/>
  <key>WorkingDirectory</key>
  <string>/usr/local</string>
</dict>
</plist>

This will automatically launch the next time you log in.

To launch it immediately:

launchctl load ~/Library/LaunchAgents/com.mopidy.server.plist

Then check if the process is actually running:

$ ps aux|grep mopidy
hckr         81096   0.2  0.4  2599016  29448   ??  U     1:53AM   0:00.56 /usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python /usr/local/bin/mopidy
hckr         81104   0.0  0.0  2432784    616 s015  R+    1:53AM   0:00.00 grep mopidy

Date: 2014-01-11T02:05-0600

Author: AJ

Org version 7.9.3f with Emacs version 24

Validate XHTML 1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment