Building MythTV on Mac OS X
The easiest way to build MythTV from source is to download the packager script.
This script just needs XCode and an internet connection - it downloads and builds all the dependencies, and if you are lucky gives you several double-clickable applications.
Building MythTV Manually
The packager script doesn't always work. Maybe one of the downloadable dependencies has been outdated, and someone needs to try building against a newer one. Maybe the MythTV source code has changed and broken Mac builds. Look on the Myth_on_Mac_-_Build_status page for hints about this.
To get current information about what the build process should look like, you can always inspect the script. Obviously if the script is failing then there will be at least one part of it that needs a tweak, but the remainder of the script should save you a lot of time.
The rest of this guide is meant for those who would like to try out the latest MythTV code on Mac OS X, but are having trouble setting up the development environment. Many folks have had trouble figuring out which dependencies and versions are necessary, so this will help you get to a known working configuration. If you like to copy-and-paste commands, you'll love this guide.
If you just want to watch TV on your Mac, and you aren't planning to do development, you're better off using a prebuilt binary.
These instructions also assume that you're doing a completely clean reinstallation on your machine. If you don't start from scratch, some of the instructions may not be correct for your setup. If you're really having problems, back up your data and try these instructions again, doing a clean re-install of OS X as directed below.
Install OS X
The first step is to get a computer running Mac OS X. To watch TV at acceptable speeds, you'll want at least an 800 MHz G4 or better. For HDTV nearly any Intel-based Mac released from 2008 onwards will suffice.
If you're starting from scratch, install Mac OS X 10.3 (Panther) or later on your future Myth box. Do a clean installation, not an upgrade -- I recommend the "Erase and Install" option to be sure you won't have problems from earlier data on your drive. For underpowered systems, when you're offered the chance to Customize the installation, turn off all the options except "BSD Subsystem". (The option "Essential System Software" cannot be turned off, so you will have two checked items total.)
Continue with the installation and restart. Go through the setup and registration screens as normal. Once you reach the Finder, run Software Update and get any OS updates. Apply the updates and restart when directed by Software Update.
Not all software updates can be installed in one step, so you should run Software Update again after installing updates. QuickTime is used for MythVideo, so it is recommended to update that. Install any updates and restart; keep repeating this pattern until no updates remain.
Underpowered systems may also wish to disable Spotlight indexing to avoid intermittent performance drops.
Install OS X Developer Tools
You've got the latest and greatest OS, but the tools for compiling software are installed separately. Visit the Apple Developer Connection website and log in. If you don't have an ADC account, you can create a free one. This gives you access to Apple developer tools, prerelease software, and other useful items.
Once you've logged in, click on "Download Software" and then "Developer Tools". Download the latest "Xcode Tools" software. Install the software by opening "Xcode Tools.mpkg" from the "Xcode Tools" disk image. You can do an Easy Install, the defaults are fine for building MythTV.
To checkout MythTV from Subversion source tree the Subversion Binary Subversion Client and Server for Mac OS X is required. Download and install the application. Subversion will be installed in /usr/local/bin.
Set up your environment
That's it for the graphical Mac stuff. From here on out, we'll be working in Terminal. If you're a Unix geek, things should look a lot more familiar. If you aren't comfortable with Terminal, this probably isn't the best place to start; I suggest you learn a bit more about Unix before attempting to go further.
From a new Terminal window, start by setting up some useful environment variables in your profile. Create a .bash_profile in your favorite text editor:
# vi .bash_profile
Add the following to the new file and save it:
Next, load these variables into your current session, and create SRCDIR where you'll be downloading and compiling.
. .bash_profile mkdir $SRCDIR cd $SRCDIR
Optional: if you'd like to be able to run mythfrontend by double-clicking its icon from the Dock or the Finder, you'll have to set the
DYLD_LIBRARY_PATH environment variable for the graphical environment. (Your
.bash_profile</nowiki> only affects what you do in Terminal.) To enable this, create the file
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/[[Property List]]-1.0.dtd"> <plist version="1.0"> <dict> <key>DYLD_LIBRARY_PATH</key> <string>/usr/local/lib:/Users/username/src/qt-mac-free-3.3.8/lib</string> </dict> </plist>
Replace username above with your user name. Note that we set the same directories as in the .bash_profile, except that the other environment variables have been expanded into full paths.
Free TypeFree Type is the first of several dependencies you will have to install for MythTV. First download and unpack the source code:
curl http://download.savannah.gnu.org/releases/freetype/freetype-2.1.10.tar.gz | tar -xz cd freetype-2.1.10Next, configure and make the source. These instructions use shared libraries for building MythTV, and include flags to turn on prebinding (a run-time optimization that launches programs faster), so they differ from the generic defaults provided by the project's install instructions. If you follow the commands here exactly, you should be OK.
./configure --disable-static make LDFLAGS="-no-undefined -Wl,-prebind,-seg1addr,0xC0000000 -lz" sudo make install
sudo asks for a password, enter your Mac login password. You'll get used to doing this a lot over the course of this guide.
SRCDIRin preparation for the next step.
Freetype can also be installed via Fink or Portage OS X. See Fink And Portage for more information.
LAMEThe process here is the same as Free Type, so I won't repeat the same explanations. Just use these commands:
curl http://superb-west.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz | tar -xz cd lame-3.97 ./configure --disable-static --disable-frontend make LDFLAGS="-no-undefined -Wl,-prebind,-seg1addr,0xC1000000" sudo make install cd ..
LAME can also be installed via Fink or Portage OS X. See Fink And Portage for more information.
Again, there's nothing too complicated. You only need the client library from MySQL, so these commands turn off a lot of the parts that the installation offers.
curl http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/mysql-5.0.87.tar.gz | tar -zx cd mysql-5.0.92 ./configure --disable-static --without-debug \ --without-server --without-geometry \ --without-extra-tools --without-docs \ --without-man --without-bench make LDFLAGS="-no-undefined -Wl,-prebind,-seg1addr,0xC2000000" sudo make install cd ..
curl ftp://ftp.trolltech.no/qt/source/qt-everywhere-opensource-src-4.6.0.tar.gz | tar -xz cd qt-mac-free-4.6.0
Make sure you update Quicktime completely, including the Quicktime SDK, using Software Update.
Next, configure the installation. Qt takes a long time to build, so we turn off everything that's not absolutely necessary.
./configure -release -fast -qt-sql-mysql \ -no-accessibility -no-stl \ -no-sql-sqlite -no-sql-odbc -system-zlib -no-libtiff \ -no-libmng -nomake examples -nomake demos \ -no-nis -no-cups -no-qdbus -no-framework' \ -I/usr/local/include/mysql \ -L/usr/local/lib/mysql
The configure step takes a while, but don't go get that cup of coffee right away; you will have to accept the GNU General Public License before it gets going. Type
yes when it prompts you, then you can take a break.
The make process requires a bit of explanation. For older releases (before 0.23), Qt needed the
-single-module< flag to build correctly with our MySQL installation; the first line adds this to the compile instructions.
echo 'QMAKE_LFLAGS_SHLIB += -single_module' >> src/qt.pro make sub-src
We only build the
sub-src target, as we only need the Qt library; this skips the documentation, examples, and a hundred other things that aren't necessary for working with MythTV.
Check the osx-packager.pl script for what is required by the current release.
We're now finished with Qt, and with all of the dependencies in fact.
Alternatively to compiling Qt yourself, you can grab a precompiled package from http://naranja.umh.es/~atg/
Backend SetupMake sure you set your backend to listen on some other IP address than 127.0.0.1 (which is the default). Run
on your backend mythtv installation and put your not-127.0.0.1 IP adress in the database parameters; 192.168.1.x perhaps, whatever your network interface runs on and more importantly what IP address you set mysql to listen on.
You'll also need to allow connections to the mySQL server on your backend machine over your network.
mysql> grant all on mythconverg.* to mythtv@"10.0.1.%" identified by "mythtv";
NOTE: If you decide to run ./configure and not use the osx-packager.pl, you MUST use the --disable-distcc flag or else your configure step will fail with some endianness check message.Finally, we're ready for MythTV itself. Download the main MythTV source:
svn co http://svn.mythtv.org/svn/branches/release-0-20-fixes/mythtvNow we configure and make MythTV itself. Assuming that nothing is broken in the SVN tree (which happens sometimes for the Mac build), the defaults should work fine:
cd mythtv sudo ./configure --disable-distcc make sudo make install
If you look at your
config.err file and see that the endian test failed, just use the osx-packager.pl script in the
contrib directory to build MythTV.
mythtvdirectory already, simply type:
cd contrib perl osx-packager.pl
It may still fail using GCC 4.x but should work if you change your GCC modules to 3.3.3-7. It will take a while to complete. Basically, it re-installs everything you have installed to this point.
source: mythtv-user list
If you're missing qmake, return to the qt-mac-free-3.3.8 directory from the previous installation and install it from there:
cd ../qt-mac-free-3.3.8 cd qmake sudo make installYou must launch the frontend from the command line, as launching it through the Finder will not work properly (unless you completed the Optional section of step 3). Run the frontend with this command:
You'll be prompted for the MySQL connection parameters when it starts up. Enter the hostname for your Linux backend, and change any of the other parameters as appropriate. (This part is not Mac-specific and depends on your backend setup.) You should see the main menu for the frontend after it successfully connects to the MySQL server.When you update to the latest CVS, you should do a clean rebuild to prevent problems:
make distclean cvs -z6 update -dP ./configure qmake mythtv.pro make sudo make install
Building MythFrontend for an AppleTV v1
To build for the AppleTV, you need to build on the same platform - OS X 10.4. Apple change the binary linkage around 10.5.6 and cross-compiling has not (yet!) been successful. You will need to update the make command on 10.4 to version 3.82 in order to build some components.
To configure mythtv for ATV, you'll probably want the remote control patch from http://code.mythtv.org/trac/ticket/6422 as the remote control won't work without it. The two patches on the ticket also contain some other hacks to make the build work properly for the appletv.
Once your build tree has been patched, configure with:
./configure --disable-ssse3 --disable-mmx2 --disable-amd3dnow --disable-amd3dnowext \ --disable-lirc --disable-firewire --disable-iptv --disable-hdhomerun --disable-v4l \ --disable-dvb --disable-ivtv --disable-joystick-menu --disable-hdpvr --disable-distcc
This keeps the binary minimal. Then do:
make sudo make install
To make the MythFrontend.app, use the osx-bundler.pl script from the packaging repository to create it.
osx-bundler.pl mythfrontend /usr/local/lib /usr/local/lib/mysql /usr/local/lib/mythtv /usr/local/Trolltech/Qt-4.6.0/lib
This assumes that you've not changed your prefix from the default.
For More Information
Try the mailing lists