From MythTV Official Wiki
Revision as of 13:37, 18 January 2013 by YLee (talk | contribs) (Better Mac backend: Job queue)

Jump to: navigation, search

A new process for building Myth on OS X.


Better Mac backend

The current Perl-based build processes are great for producing a self-contained Mac frontend. But if you are like me and want to run the backend on OS X, then having the essential programs packaged deep in an application bundle is less than ideal. The MacPorts distribution aims to make it much easier to install the backend and run it in a production mode:

  • Full support of the Perl/python bindings. This means that standard Myth backup, optimization, and metadata functions will work.
  • Install and run Myth like other 'server-type' software such as MySQL, file-sharing, web-serving, etc. Control the Myth backend with standard OS X functions (launchctl) and have the system start automatically during the boot process.
  • Provide the full suite of myth programs, if you need them, like mythmetadatalookup, mythutil, etc.

The documentation on this page will focus on running the Myth master backend (version 0.25.2), including the MySQL database server, on an OS X machine. Using the MacPorts install it is also possible to run the machine as a slave backend or job queue server. It may be possible to run the machine as a Myth media server; this configurations hasn't been tested. If you do, please share the results by updating these pages!

Consistent, repeatable build process

MacPorts is a stable and mature system for bringing open-source software to the Mac platform. Changes are tested and reviewed before being committed to MacPorts. MacPorts operates some build slaves (Lion and Snow Leopard, both on 64 bit machines, currently) which automatically build the default variant of each port. All this means that if you decide to try building with MacPorts, there is a strong likelihood that it will just work. And, if it doesn't, there is an active support system working to resolve any problems.

Applescript Helpers

On OS X, diving into the command line just to start the Myth frontend isn't very 'Mac-like'! So the MacPorts installation of Myth included a handful of simple Applescript applications to make common activities just a little more convenient:

Under Applications > MacPorts > mythtv.25

Myth_Setup and Myth_Filldatabase are probably only going to be necessary when you first confgure Myth or make major changes. Myth_Frontend, however, is the preferred way to start the frontend. You may want to drag the Myth_Frontend icon onto your Dock if you plan to use it regularly.

Myth_Stop_Start provides a simple way to start the Myth backend and to schedule daily log file rotation and pruning. Note that the Myth backend is run as a server process. That means, if enabled, it starts automatically when OS X is started--no user needs to be logged on. Similarly, f you click "Stop MythBackend", the server process will remain disabled through restarts, etc.

Offers to Stop MythBackend, if running

The script looks for a MySQL server running on the current machine and won't start the backend without one. If your database server is running on another machine on your network, this script won't work for you. You'll have to manually issue the appropriate launchctl commands.

Myth 0.25 generates a LOT of log files. We use logrotate to keep the most important ones (mythbackend, mythfrontend, mythtv-setup, etc) for two months and to delete those created by some of Myth's 'utility' programs (mythpreviewgen, mythcommflag, mythfilldatabase, mythmetadatalookup, etc).

Known issues


Plugins experimental, many features not working

Fonts: (also available through MacPorts)

Building Myth on OS X via MacPorts

See Building Myth for Mac with MacPorts for details

The MacPorts build process has been successfully tested on OS X 10.5, 10.6, 10.7, and 10.8. Building with firewire support to capture mpeg streams from a set top box has been successfully implemented under 10.5.8 on a PPC G5, and under 10.8.2 on an Intel Mini.

Before first run


First, Myth's database (mythconverg) has to be intialized, and the server software started, with the following three commands:

sudo -u _mysql mysql_install_db5

sudo port load mysql5

mysql5 -u root -p < /opt/local/share/mythtv/database/mc.sql

Look in Activity Monitor to see that the "mysqld" is running. We can't go further until it is!

Media Storage Locations

Next, Myth needs to be told where to store all your media. It is common to dedicate one or more external disks--and usually not the startup disk--to hold your recordings, videos, music, etc. At the bare minimum, create at least one new folder to use as the default for everything that Myth wants to store. More commonly, you'll have separate directories for TV, Videos, Music, Images, and Metadata. It will be simpler to use volume and folder names that do not include spaces. On OS X, the path to a folder on an external drive is "/Volumes/<drive_name>/<folder_name>".

Initial Myth Setup

After you've created the directories you want to use (and made note of the paths), you must run the mythtv-setup program. You can do this from the command line but there is also an Applescript (Myth_Setup) short cut. Be sure to complete each of the steps.

You will likely need to run Myth_Filldatabase at this point to populate the fill in all those television programs that your tuner(s) will be able to record. Unfortunately, the Applescript can't show the progress of this program as it runs. Activity Monitor should list mythfilldatabase as it is running and it should finish within a few minutes.

Start It Up!

We're getting close now. With Myth's setup done, it is time to start the backend. Use the Myth_Start_Stop Applescript to start the backend. Again, in Activity Monitor you should see a new line for "mythbackend".

The grand finale: start up the frontend with the Myth_Frontend Applescript. Hopefully all has gone well and you're off and running with Myth on OS X!!


sudo port select --set python python26


MythWeb can also be installed via MacPorts. See MythWeb via MacPorts for installation instructions.


To do: running the Job queue on other OS X machines ...