Difference between revisions of "Building Myth for Mac with MacPorts"

From MythTV Official Wiki
Jump to: navigation, search
(retrieve db init from old instructions)
(fix path)
Line 54: Line 54:
 
sudo -u _mysql mysql_install_db
 
sudo -u _mysql mysql_install_db
  
sudo cp /opt/local/share/mythtv/database/my.cnf /opt/dvr/etc/mariadb
+
sudo cp /opt/local/share/mythtv/database/my.cnf /opt/local/etc/mariadb
  
 
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mariadb-server.plist  
 
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mariadb-server.plist  

Revision as of 13:34, 4 August 2017

This page provides a cookbook for building MythTV for Mac OS X via MacPorts. It is assumed that you have at least a little experience using Terminal on the Mac to run command-line driven programs. See the page Myth for Mac with MacPorts for more information. OS X 10.9 (Mavericks), or newer, is now required.


About MacPorts

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 several build slaves (10.4 through 10.12 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.


Install XCode and MacPorts

In order to install any version of Myth via MacPorts, you first need to obtain the appropriate version of XCode for your version of OS X. Then install the latest version of MacPorts. The MacPorts web site has a good summary:

see http://www.macports.org/install.php


Myth 0.28.1

Myth 0.28.1 is the current release of MythTV and is recommended for all users.

Upgrading from a previous version of Myth?

  • Shutdown Myth with Myth_Stop_Start
  • Backup your database:
Using Terminal, enter the following What happens
/opt/local/share/mythtv/mythconverg_backup.pl -directory ~/Desktop 
 --mysqldump /opt/local/lib/mariadb/bin/mysqldump --verbose
Saves the current state of your Myth software (settings, rules, guide data, etc) into a compressed backup file. If the upgrade fails, you can restore this file and restart your previous version of Myth.


Build and Install Myth 0.28.1

Myth is a big software package with over 100 dependencies. If you are using a default prefix, much of the software will be installed from pre-compiled binaries. Some packages, however, have a restrictive licence such that they must be built from source. MacPorts will do all this automatically. However, the process will take time. The amount of time depends on the speed of your internet connection and your Mac's processing power. Please be patient.

With XCode and MacPorts installed, use Terminal to run the following commands:

At the Terminal prompt, you enter What happens
sudo port install mythtv.28 
+mariadb+mariadb55+python27+perl5_24-x11+startupitem
Download, build and install the MythTV. This includes the frontend, backend, perl and python bindings. All relevant dependencies, including the database client software, will also be installed and, therefore, the first time through, it may take 1 hour or more. Depending on the speed of your Mac, future updates can take as little as 15 minutes.


Congratulations, you just built Myth for Mac. Virtually all of the installed software and support files are under '/opt/local/' at the root of your hard drive. Feel free to use the Finder to explore.

Initial database configuration

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

sudo -u _mysql mysql_install_db

sudo cp /opt/local/share/mythtv/database/my.cnf /opt/local/etc/mariadb

sudo launchctl load -w /Library/LaunchDaemons/org.macports.mariadb-server.plist 

mysql -u root < /opt/local/share/mythtv/database/mythconverg_init.sql

Add '-p' to the third command if you've followed the (very reasonable) instructions to protect the root account on your MySQL database with a password. After this command, look in Activity Monitor to see that the "mysqld" is running. We can't go further until it is!

mysql -u mythtv -p mythconverg

The above step simply verifies that you can connect to the database as the 'mythtv' user (default password is 'mythtv'). Type 'exit;' and press return to exit back to the Terminal. A one-time step is required to install support for multiple time zones in MySQL. Follow the procedure on MySQL Time Zone Tables to ensure that your MySQL installation is ready for Myth 0.26 or 0.27. Doing this will not affect the operation of Myth 0.25, either. Note, on MySQL on my system, the user "mythtv" has the password "mythtv" but the user "root" has no password. (Don't tell anyone, OK? I don't want my database hacked!  ;) Terminal may not be able to find the command unless you enter the full path. The command that worked for me was:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

This final step loads time zone information into MySQL. (Again, add '-p', if necessary.) You may get a series of warning messages. These are no cause for alarm unless your specific time zone is not loaded.

Upgrading Myth 0.28

The mythtv.28 port is based on Myth's 0.28-Fixes branch and is updated periodically as important commits are applied. MacPorts also regularly updates other ports which Myth may rely on. To check for and apply upgrades:

At the Terminal prompt, you enter What happens
sudo port selfupdate
MacPorts downloads an updated list of available ports and, if necessary, updates the MacPorts software itself.
port outdated
MacPorts compares, for each installed port, your installed version versus the currently available version. It lists any ports that are not at the latest version.
sudo port upgrade mythtv.28
Upgrade to the latest version of MythTV available through MacPorts. This upgrades the MythTV software and any of the dependencies that were installed to support it.
sudo port upgrade outdated
This upgrades any and all ports that are not at the current version supplied by MacPorts. Obviously, this may take a long time if there are a large number of outdated ports or if something like Qt is affected.

Uninstall Myth 0.28.1

MacPorts keeps track of every file it installed and makes it easy to uninstall software, if needed. Use Terminal to run one of the following commands.

Before uninstalling Myth, make sure mythbackend is not running. Check Activity Monitor, the 'top' utility or similar. See Myth for Mac with MacPorts for information on stopping the backend.

Enter one of the following What happens
sudo port uninstall --follow-dependencies mythtv.28
This option completely removes the MythTV software and all the other dependencies that were installed to support it (such as Qt, MySQL, etc). If, later, you want to reinstall Myth, it may take multiple hours to build everything again.
sudo port uninstall mythtv.28
This option completely removes the MythTV software from your machine but leaves all the dependencies installed. Reinstalling Myth will be faster than the above option and slower than the following.
sudo port deactivate mythtv.28
This option saves the current version of MythTV in an archive but otherwise removes the software from your machine. Again, it leaves all dependencies installed. The advantage is that Myth can be re-installed in a minute or two with the "activate" command.

Problems?

If you have any problems building MythTV via MacPorts, please post to the macports-users mailing list. If necessary, please file a bug with the MacPorts bug tracker.

MacPorts-users mailing list == https://lists.macosforge.org/mailman/listinfo/macports-users

MacPorts ticket system == http://guide.macports.org/#project.tickets