{{Note box|This page is meant to help those who wish to build MythTV for OSX without using the <code>osx-packager.pl</code> script. Most users should visit [[MythTV on Mac OS X]] instead.}}

{{Note box|This page is meant to help those who wish to build MythTV for OSX without using the <code>osx-packager.pl</code> script. Most users should visit [[MythTV on Mac OS X]] instead.}}

+

+

{{Warning}} To get a hint of build problems you may or may not encounter, please check the build status page at [[Myth_on_Mac_-_Build_status]].

= Building Automatically =

= Building Automatically =

−

The easiest way to build MythTV from source is to download the packager script. Either http://svn.mythtv.org/svn/branches/release-0-22-fixes/mythtv/contrib/OSX/osx-packager.pl or http://svn.mythtv.org/svn/trunk/packaging/OSX/build/osx-packager.pl. 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.

+

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 =

= Building MythTV Manually =

Line 15:

Line 24:

−

{{Note box| To use a handbuilt OS X version, it may be easier to start with a Linux machine running a recent SVN version of MythTV to act as a backend. If you've never installed MythTV, you can first set up Linux version such as MythBuntu, and only look at the OS X version once everything's working properly there. That said, don't be discouraged; many people use a OS X with FireWire STBs, IPTV, and the HD Home Run.}}

+

{{Note box| To use a handbuilt OS X version, it may be easier to start with a Linux machine running a recent version of MythTV to act as a backend. If you've never installed MythTV, you can first set up Linux version such as MythBuntu, and only look at the OS X version once everything's working properly there. That said, don't be discouraged; many people use a OS X with FireWire STBs, IPTV, and the HD Home Run.}}

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.

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.

Line 25:

Line 34:

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.

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.)

+

If you're starting from scratch, install Mac OS X 10.7 (Lion) 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.

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.

Line 44:

Line 53:

{{Warning}} Many of the instructions below may be out of date, or geared to specific environments.

{{Warning}} Many of the instructions below may be out of date, or geared to specific environments.

−

−

=== Set up your environment ===

=== Set up your environment ===

Line 121:

Line 128:

=== MySQL ===

=== MySQL ===

−

{{Note box|MySQL removes older versions of their software from their servers after a while. If mysql-5.0.87.tar.gz disappears, go to the server [http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg here] and find the latest mysql-5.0.XX.tar.gz. Change the version number in the instructions below and mysql should build fine.}}

+

{{Note box|MySQL removes older versions of their software from their servers after a while. If mysql-5.0.92.tar.gz disappears, go to the server [http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg here] and find the latest mysql-5.0.XX.tar.gz. Change the version number in the instructions below and mysql should build fine.}}

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. <pre>

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. <pre>

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 <code>yes</code> when it prompts you, then you can take a break.

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 <code>yes</code> when it prompts you, then you can take a break.

−

The make process requires a bit of explanation. Qt needs the <code>-single-module<</code> flag to build correctly with our MySQL installation; the first line adds this to the compile instructions. We only build the <code>sub-src</code> 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. <pre>

+

The make process requires a bit of explanation. For older releases (before 0.23), Qt needed the <code>-single-module<</code> flag to build correctly with our MySQL installation; the first line adds this to the compile instructions.

+

+

<pre>

echo 'QMAKE_LFLAGS_SHLIB += -single_module' >> src/qt.pro

echo 'QMAKE_LFLAGS_SHLIB += -single_module' >> src/qt.pro

make sub-src

make sub-src

</pre>

</pre>

+

+

We only build the <code>sub-src</code> 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.

We're now finished with Qt, and with all of the dependencies in fact.

cd ..

cd ..

+

Line 229:

Line 244:

sudo make install

sudo make install

</nowiki></pre>

</nowiki></pre>

+

+

==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.

Building Automatically

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.

Note: To use a handbuilt OS X version, it may be easier to start with a Linux machine running a recent version of MythTV to act as a backend. If you've never installed MythTV, you can first set up Linux version such as MythBuntu, and only look at the OS X version once everything's working properly there. That said, don't be discouraged; many people use a OS X with FireWire STBs, IPTV, and the HD Home Run.

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.7 (Lion) 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.

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.

Many of the instructions below may be out of date, or geared to specific environments.

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:

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

Next, 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.

LAME can also be installed via Fink or Portage OS X. See Fink And Portage for more information.

MySQL

Note: MySQL removes older versions of their software from their servers after a while. If mysql-5.0.92.tar.gz disappears, go to the server here and find the latest mysql-5.0.XX.tar.gz. Change the version number in the instructions below and mysql should build fine.

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.

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.

Note: the command below turns off all window styles except "Windows"; this style looks best with MythTV, in my opinion, so I don't build the others. You may want to remove some of the -no-style-blah flags and try out other styles on your system.

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.

Now 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.

Presuming you're in the mythtv directory 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 install

You 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:

/usr/local/bin/mythfrontend.app/Contents/MacOS/mythfrontend

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:

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.