Difference between revisions of "MacPorts"

From MythTV Official Wiki
Jump to: navigation, search
(Snow Leopard through Mountain Lion)
(Modifying Perl scripts: -- new default version)
 
(63 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Coming soon!
+
{{User Manual TOC}}
  
==Goals==
+
The easiest way to install a complete [http://www.mythtv.org/detail/mythtv Myth] system on OS X. Download the installer from [https://sourceforge.net/projects/macportsmythtvinstaller/ SourceForge]
===Better Mac backend===
 
The current Perl-based build processes are great for producting 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.1), including the MySQL database server, on an OS X machine.  Using the MacPorts install, it may be possible to run the machine as a slave backend, as a job queue server or a Myth media server.  These latter kinds of configurations haven't been tested.  If you do, please share the results by updating these pages!
 
  
===Consistent, repeatable build process===
+
==Goal: Full MythTV system...Easy==
[http://www.macports.org 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.
 
==Quick Start==
 
ToDo: List of commands
 
  
Also installed are some Applescript helpers to simplify common tasks:
+
So you want a personal video recording system and you are a Mac user.  The all-in-one installer is the quickest and easiest way to get a complete Myth system up and running.
 +
 
 +
The documentation on this page will focus on running the Myth [[Mythbackend |master backend]] (version 0.28.1), 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! 
 +
 
 +
 
 +
==What's new in the 0.28.1 installer?==
 +
* up-to-date version of MythTV 0.28.1! 
 +
* install process simplified--no more Terminal commands required to get the database up and running!!
 +
* [[WebFrontend]] -- check out the initial version of planned replacement for MythWeb
 +
* lots of pesky little things (like fonts) are fixed.
 +
* Now requires OS X version 10.9 or later.  Successfully tested on OS X 10.9 through 10.12.
 +
 
 +
 
 +
==Download or build?==
 +
Most users will want to download the pre-built installer:
 +
 
 +
https://sourceforge.net/projects/macportsmythtvinstaller/
 +
 
 +
However, don't use the downloaded installer if any of the following are true:
 +
*You want a version earlier than 0.27.
 +
*You already have MacPorts installed for other software.
 +
*You think you ''might'' want to install MacPorts to use some of the thousands of other software packages available.
 +
*You like watching the compiler churn away building millions of lines of code!  ;)
 +
 
 +
See [[Building Myth for Mac with MacPorts]] for details on that process.
 +
 
 +
Seriously, most users will want to download the pre-built installer.  It will give you a complete install of MythTV for OS X, including:
 +
*backend and MySQL, the background processes that are the heart of Myth's recording system
 +
*frontend, the interface to setting recording rules and enjoying TV, videos, etc.
 +
*MythWeb, for accessing and controlling your Myth system via a web browser
 +
*all the support packages to make everything 'just work'!
 +
 
 +
The '''main difference''' between installing from the pre-built installer and building your own is the path to all the files.  The pre-built installer loads everything under "/opt/dvr" while building your own puts everything under "/opt/local".  For example, the frontend program is at '/opt/dvr/bin/mythfrontend' from the pre-built installer while the version you build yourself will be at '/opt/local/bin/mythfrontend'.  The following instructions assume you're using the pre-built installer.  If you built your own, change every instance of '/opt/dvr' to '/opt/local' in the following.
 +
 
 +
DON'T MIX THE TWO INSTALL METHODS!  The two install methods are not compatible.  Ask for help if you have trouble with your chosen install method.  Using one and then the other almost always results in chaos.
 +
 
 +
==Initial Installation==
 +
 
 +
Upgrading?  See the following section.
 +
 
 +
The installer is "all-in-one"--everything needed to run MythTV on Mac OS X is included.  Fire up the installer, follow the instructions and let it work away for a few minutes.  You need about 1.2 GB of free space for all the software that is installed.  And much more for the video you'll be recording.
 +
 
 +
====Media Storage Locations====
 +
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 <em>do not</em> include spaces.  On OS X, the path to a folder on an external drive is "/Volumes/<drive_name>/<folder_name>".
 +
 
 +
The User Manual also has general information on how to [[Setup Storage Directories]] for MythTV.
 +
 
 +
====Myth Setup====
 +
After you've created the directories you want to use (and made note of the paths), you <em>must</em> 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 review/complete each of the steps.
 +
 
 +
=====Capture Cards and Video Sources=====
 +
Pretty much the only Capture Cards that are supported on OS X are the [[Silicondust_HDHomeRun|HDHomerun tuners from Silicondust]]...although some [[IPTV]] or [[User_Manual:Setting_up_HTTP_Live_Streaming_Recorder|HTTP Live Streaming]] services may also work.  From the linked page, find the model you are using (Prime, Plus, Dual, etc) and follow the instructions to add and configure the tuners.  Your video source depends on which tuner you are using and where in the world you are located.  SchedulesDirect is highly recommended for North America.  In mythtv-seup, create an appropriate [[Video_Source#Video_sources|Video Source]] and connect it to your Capture Card(s) using the Input Connections screen.
 +
 
 +
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 the backend====
 +
The MacPorts installation of Myth included a handful of simple Applescript applications to make common activities just a little more convenient:
  
 
[[File:FinderWindow.png|none|frame|Under Applications > MacPorts > mythtv.25]]
 
[[File:FinderWindow.png|none|frame|Under Applications > MacPorts > mythtv.25]]
  
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. 
 +
 
 +
[[File:StopeStart 2.png|none|frame|Offers to Stop MythBackend, if running]]
 +
 
 +
When you have finished with mythtv-setup, it is time to start the backend using the Myth_Start_Stop helper.  In Activity Monitor you should see a new line for "mythbackend". 
 +
 
 +
Myth 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) more frequently.
 +
 
 +
====Launch the frontend====
 +
The grand finale:  start up the frontend with the Myth_Frontend helper.  You may want to drag the Myth_Frontend icon onto your Dock if you plan to use it regularly. Hopefully all has gone well and you're off and running with Myth on OS X!! 
 +
 
 +
If you switch to Activity Monitor (via Command-Tab), you'll see mysql, the backend and the frontend all running:
 +
 
 +
[[File:ActivityMonitorSample.jpg|450px]]
 +
 
 +
==Upgrading an Existing Installation==
 +
 
 +
If you previously installed Myth 0.27.5 from the all-in-one installer, you can simply upgrade by running the 0.28.1 installer.  Your recordings, other media, database and settings will not be affected.  Just use Myth Stop Start to stop the backend before you install and then use it afterward to start up the new version.
 +
 
 +
 
 +
==MythWeb==
 +
 
 +
[[MythWeb]] is installed automatically with the pre-built installer.  If you don't want to use it, just ignore it.  (It only takes up a MB's of disk space. 
  
Myth_Stop_Start provides a quick way to start or quit the Myth backend server program.
+
To get started using MythWeb, see [[MythWeb via MacPorts]] for instructions.
  
[[File:StopStart.png|none|frame|Offers to Stop MythBackend, if running]]
 
  
 
==Known issues==
 
==Known issues==
ToDo:
 
  
Plugins experimental, many features not working
+
For some users, mythbackend takes 5 minutes to start up after a reboot.  It appears that some service is not ready when mythbackend is automatically launched after a reboot--likely the network.  Still looking for a solution but the workaround is just to wait.  The backend will automatically attempt another launch in 5 minutes and then all will be well.
 +
 
 +
On certain screens, Myth may stop accepting key presses (either keyboard or remote).  This happens in mythtv-setup and in certain setup screen in mythfrontend.  Workaround:  click with a mouse!  Clicking anywhere on the screen with a pointing device will restore focus to the screen and make key presses work again. 
  
  
Fonts:
+
==Scripts==
  
http://dejavu-fonts.org/wiki/Download
+
One of the strengths of Myth is the ability to customize the system to your particular needs, often using scripts written in Python, Perl or Bash (shell scripts).  See [[User Job Scripts]] for examples.
  
https://fedorahosted.org/liberation-fonts/
+
You can run all these kinds of scripts on your OS X machine although there is one 'gotcha' to watch for with Myth via MacPorts. Perl and Python scripts often use "bindings" provided by MythTV to simplify the programming required to interface with Myth's database.  Those bindings are built and installed with Myth under MacPorts--but you will probably have to make a slight modification to such scripts so they make use of the bindings. 
  
==Building Myth on OS X via MacPorts==
+
===Modifying Perl scripts===
See [[Building Myth for Mac with MacPorts]] for details
 
  
The MacPorts build process has been successfully tested on OS X 10.6, 10.7 and 10.8.
+
Change the first line of the script from
  
==Before first run==
+
#!/usr/bin/perl
Mythconverg database (link)
+
to
 +
  #/opt/dvr/bin/perl5.26
  
sudo -u _mysql mysql_install_db5
+
===Modifying Python scripts===
  
mysql5 -u root -p < /opt/local/share/mythtv/database/mc.sql
+
For example, [[mythvidexport.py]].  Change to first line of the script from
  
sudo port select --set python python26
+
#!/usr/bin/env python
 +
to
 +
#!/opt/dvr/bin/python2.7
  
Directories for TV, Videos, Music, Images, Metadata
+
===MacPorts-delivered scripts===
  
MythTV-Setup
+
Currently, Myth via MacPorts includes a handful of scripts which have already been modified and are ready to use.  These include the backup and restore scripts
  
MythFillDatabase
+
/opt/dvr/share/mythtv/mythconverg_backup.pl
 +
/opt/dvr/share/mythtv/mythconverg_restore.pl
  
==Testing==
+
Also, a couple of contributed scripts, [[optimize_mythdb.pl]] and [[mythlink.pl]]
Backend with command line
 
  
Frontend: Applescript or command line
+
/opt/dvr/share/mythtv/contrib/optimize_mythdb.pl
==Production==
+
/opt/dvr/share/mythtv/contrib/mythlink.pl
Launchd keeps the backend running
 
  
Multiple frontends
+
==Other==
  
Job queue on other machines
+
To do: running the Job queue on other OS X machines ...
  
  
 +
[[Category:Software Installation|1300]]
 
[[Category:MacOS]]
 
[[Category:MacOS]]
 
[[Category:MacPorts]]
 
[[Category:MacPorts]]

Latest revision as of 16:25, 15 November 2017


The easiest way to install a complete Myth system on OS X. Download the installer from SourceForge


Goal: Full MythTV system...Easy

So you want a personal video recording system and you are a Mac user. The all-in-one installer is the quickest and easiest way to get a complete Myth system up and running.

The documentation on this page will focus on running the Myth master backend (version 0.28.1), 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!


What's new in the 0.28.1 installer?

  • up-to-date version of MythTV 0.28.1!
  • install process simplified--no more Terminal commands required to get the database up and running!!
  • WebFrontend -- check out the initial version of planned replacement for MythWeb
  • lots of pesky little things (like fonts) are fixed.
  • Now requires OS X version 10.9 or later. Successfully tested on OS X 10.9 through 10.12.


Download or build?

Most users will want to download the pre-built installer:

https://sourceforge.net/projects/macportsmythtvinstaller/

However, don't use the downloaded installer if any of the following are true:

  • You want a version earlier than 0.27.
  • You already have MacPorts installed for other software.
  • You think you might want to install MacPorts to use some of the thousands of other software packages available.
  • You like watching the compiler churn away building millions of lines of code!  ;)

See Building Myth for Mac with MacPorts for details on that process.

Seriously, most users will want to download the pre-built installer. It will give you a complete install of MythTV for OS X, including:

  • backend and MySQL, the background processes that are the heart of Myth's recording system
  • frontend, the interface to setting recording rules and enjoying TV, videos, etc.
  • MythWeb, for accessing and controlling your Myth system via a web browser
  • all the support packages to make everything 'just work'!

The main difference between installing from the pre-built installer and building your own is the path to all the files. The pre-built installer loads everything under "/opt/dvr" while building your own puts everything under "/opt/local". For example, the frontend program is at '/opt/dvr/bin/mythfrontend' from the pre-built installer while the version you build yourself will be at '/opt/local/bin/mythfrontend'. The following instructions assume you're using the pre-built installer. If you built your own, change every instance of '/opt/dvr' to '/opt/local' in the following.

DON'T MIX THE TWO INSTALL METHODS! The two install methods are not compatible. Ask for help if you have trouble with your chosen install method. Using one and then the other almost always results in chaos.

Initial Installation

Upgrading? See the following section.

The installer is "all-in-one"--everything needed to run MythTV on Mac OS X is included. Fire up the installer, follow the instructions and let it work away for a few minutes. You need about 1.2 GB of free space for all the software that is installed. And much more for the video you'll be recording.

Media Storage Locations

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

The User Manual also has general information on how to Setup Storage Directories for MythTV.

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 review/complete each of the steps.

Capture Cards and Video Sources

Pretty much the only Capture Cards that are supported on OS X are the HDHomerun tuners from Silicondust...although some IPTV or HTTP Live Streaming services may also work. From the linked page, find the model you are using (Prime, Plus, Dual, etc) and follow the instructions to add and configure the tuners. Your video source depends on which tuner you are using and where in the world you are located. SchedulesDirect is highly recommended for North America. In mythtv-seup, create an appropriate Video Source and connect it to your Capture Card(s) using the Input Connections screen.

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 the backend

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_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

When you have finished with mythtv-setup, it is time to start the backend using the Myth_Start_Stop helper. In Activity Monitor you should see a new line for "mythbackend".

Myth 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) more frequently.

Launch the frontend

The grand finale: start up the frontend with the Myth_Frontend helper. You may want to drag the Myth_Frontend icon onto your Dock if you plan to use it regularly. Hopefully all has gone well and you're off and running with Myth on OS X!!

If you switch to Activity Monitor (via Command-Tab), you'll see mysql, the backend and the frontend all running:

ActivityMonitorSample.jpg

Upgrading an Existing Installation

If you previously installed Myth 0.27.5 from the all-in-one installer, you can simply upgrade by running the 0.28.1 installer. Your recordings, other media, database and settings will not be affected. Just use Myth Stop Start to stop the backend before you install and then use it afterward to start up the new version.


MythWeb

MythWeb is installed automatically with the pre-built installer. If you don't want to use it, just ignore it. (It only takes up a MB's of disk space.

To get started using MythWeb, see MythWeb via MacPorts for instructions.


Known issues

For some users, mythbackend takes 5 minutes to start up after a reboot. It appears that some service is not ready when mythbackend is automatically launched after a reboot--likely the network. Still looking for a solution but the workaround is just to wait. The backend will automatically attempt another launch in 5 minutes and then all will be well.

On certain screens, Myth may stop accepting key presses (either keyboard or remote). This happens in mythtv-setup and in certain setup screen in mythfrontend. Workaround: click with a mouse! Clicking anywhere on the screen with a pointing device will restore focus to the screen and make key presses work again.


Scripts

One of the strengths of Myth is the ability to customize the system to your particular needs, often using scripts written in Python, Perl or Bash (shell scripts). See User Job Scripts for examples.

You can run all these kinds of scripts on your OS X machine although there is one 'gotcha' to watch for with Myth via MacPorts. Perl and Python scripts often use "bindings" provided by MythTV to simplify the programming required to interface with Myth's database. Those bindings are built and installed with Myth under MacPorts--but you will probably have to make a slight modification to such scripts so they make use of the bindings.

Modifying Perl scripts

Change the first line of the script from

#!/usr/bin/perl

to

#/opt/dvr/bin/perl5.26

Modifying Python scripts

For example, mythvidexport.py. Change to first line of the script from

#!/usr/bin/env python

to

#!/opt/dvr/bin/python2.7

MacPorts-delivered scripts

Currently, Myth via MacPorts includes a handful of scripts which have already been modified and are ready to use. These include the backup and restore scripts

/opt/dvr/share/mythtv/mythconverg_backup.pl /opt/dvr/share/mythtv/mythconverg_restore.pl

Also, a couple of contributed scripts, optimize_mythdb.pl and mythlink.pl

/opt/dvr/share/mythtv/contrib/optimize_mythdb.pl
/opt/dvr/share/mythtv/contrib/mythlink.pl

Other

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