About

This page describes the process of installing, updating and removing FreeSWITCH™ and its prerequisites on macOS using the Terminal application instead of the macFI. This page is part of the FreeSWITCH™ macOS documentation.---

It takes about two hours to have the sample FreeSWITCH™ configuration running on macOS. There's extra information for technical people who want it, don't be concerned if you don't understand it.

Preparation

Backup

All of the software this procedure installs can be removed easily except for a small part of Xcode's Command Line Tools that can remain. However, to restore to a point where nothing was installed a backup is required.

Terminal Application Preferences

The Terminal application is used extensively during installation. The following changes are highly recommended:

Copy Terminal in the Applications/Utilities folder into the Dock for quick access.

Start the Terminal application by clicking it in the dock. Then open its preferences panel.

In Settings–>Profiles–>Window change the Window Size to larger values such as 140x48 to reduce having to resize the window often.

Installation Directories

Show Invisible Files and Directories in the Finder

macOS hides many Unix directories and files from the Finder including the directories created by this procedure. These files and directories must be unhidden so they appear on the desktop, Finder windows and file dialogs. Additional information and scripts for showing invisible files are in the macOS Customization guide. View hidden files by running the lines below in Terminal:

defaults write com.apple.finder AppleShowAllFiles YES
killall Finder

Directories Overview and Security

All FreeSWITCH™ and prerequisite files are placed into the macOS provided /usr/local directory which is normally empty and intended for additional software such as FreeSWITCH™. Having a single location allows easy removal. This procedure adds the following subdirectories to /usr/local:

The /usr/local directory is protected by System Integrity Protection (aka rootless) and cannot be removed or changed. Subdirectores of /usr/local can be added or removed using administrator authority. The subdirectories can then have their security changed so that non-administrators can modify them.

Create /usr/local Subdirectories

The user name (owner) and group name of the /usr/local subdirectories created by this procedure must match the user and group FreeSWITCH™ will run under. This is typically the main user name of the Mac. Use the mkdir command to create the freeswitch and src directories and the chown command to change the owner. Copy/paste these commands in Terminal, sudo will prompt for the administrator password:

If you would like to see the ownership and permissions of directories and files use the "ls -l" command in Terminal.

Since /usr/local is accessed often, it should be placed in the Finder "FAVORITES" sidebar for quick access. Use the Finder to navigate to the /usr/local folder and drag it under "FAVORITES".

Extra info: /usr/local/bin is defined in the default macOS path. The path is viewed by running "echo $PATH" in Terminal. If you don't understand this, don't worry, it doesn't affect anything.

--

Prerequisites

Additional programs are required to generate and run FreeSWITCH™. They are installed using Homebrew, a package manager and its repository of products for macOS. Homebrew saves time since there is no need to locate packages and determine the version required for each macOS release. Homebrew's Git repository is maintained by volunteers.

macOS Developer Tools

The macOS Developer Tools are composed of two parts, the Xcode Software Developer Kit used to develop and test macOS GUI applications, and the Command Line Tools that provide LLVM, Clang, Git and other tools required to generate non-GUI applications such as FreeSWITCH™ and its prerequisites. The Command Line Tools are included with Xcode or can be downloaded independently. If they are installed as part of Xcode and Apple upgrades Xcode, typically, only the latest release of macOS CLT are supplied. If macOS is not the latest release, the CLT will not match. This is not something you need to worry about because: Homebrew will determine if the correct Command Line Tools are already installed. If not, it will download and install them during Homebrew installation.

Install the Homebrew Package Manager and Prerequisites

The Homebrew package manager and prerequisites takes several minutes to install.

Install Homebrew

Homebrew installation is simple, the install command is found at the Homebrew home page and is listed below.

Open Terminal if not already opened, paste and run the ruby command from any directory.

Run the command "brew doctor" to verify homebrew works, this command could take a couple of minutes.

Some packages produce keg-only messages which can be ignored. It means an alias (link) for the package was not placed into /usr/local/bin because brew found that macOS has another version installed. This is not a problem because the FreeSWITCH™ installation process searches Homebrew directories to find package.

Already had some prerequisites installed?

If prerequisites were previously installed without homebrew, there may be problems.

Download FreeSWITCH™

macOS is now ready to download and install FreeSWITCH™. First, change to the directory the source will be downloaded into:

cd /usr/local/src

Selecting a Version

The primary FreeSWITCH™ releases are: The current productionversion, recommended for production systems, unless you need newer features or patches added since its release. Themaster development versioncontaining the latest fixes and features used duringdevelopment. Additional Information is located at Source Options.

Download Current Production

Current production FreeSWITCH™ versions in zip format are downloaded from freeswitch-files, then rename and move the unzipped directory to /usr/local/src. It's much easier to copy/paste the very long line below into the Terminal command line. This single line performs: 1- Determines the latest production release available. 2- Downloads the compressed source file. 3- Decompresses the file into a folder in the current directory (should be /usr/local/src/). 4- Renames the folder to freeswitch.

Download Master Development

Download FreeSWITCH™ by switching to the src directory and invoking one of the "git clone" commands below. The git command creates the freeswitch directory in src (/usr/local/src/freeswitch) and downloads the FreeSWITCH™ source files. If there are problems with the current production version, the developers may request that you install the master version or current branch for diagnosis.

git clone https://stash.freeswitch.org/scm/fs/freeswitch.git # Master Development
or
git clone –b v1.$ https://freeswitch.org/stash/scm/fs/freeswitch.git # Current branch, replace $ with release number - Use only if directed

Install FreeSWITCH™

Generate Installation and Configuration Files

This step creates installation files based on the operating system and installed packages. ./bootstrap.sh creates many files such as modules.conf used to add optional functionality to FreeSWITCH™, while ./configure sets compilation options. Enter the following commands (each will run several minutes):

cd freeswitch # <- the new freeswitch directory containing the source
./bootstrap.sh # <- Only needed if Master Development was download using git! Current Production does not include it.
./configure

Add Text–To–Speech Module

Additional functionality may be required as your FreeSWITCH™ needs become more complex. Optional modules are used to add new functions to FreeSWITCH™ by editing the modules.conf file. The FLITE Text To Speech functionality is recommended for a new system since some of the sample tests require it. The easiest way to add the FLITE module is to paste and run the following line into Terminal:

If you prefer to manually edit the modules.conf file use this procedure:

Use the Finder to navigate to the /usr/local/src/freeswitch directory.

Scroll to and double-click modules.conf in the freeswitch directory, the first time requires application selection, Textedit should be used.

Search for "flite" and remove the # to uncomment.

Save the file.

If this is your first FreeSWITCH™ don't add more than the FLITE module. Some modules may have prerequisites in addition to what is listed in this procedure.

Compile, Create Additional Source Directories and Check for Errors

This step compiles the programs and creates additional directories and files based on modules.conf. While still in /usr/local/src/freeswitch compile FreeSWITCH™ with the "make" command, it runs for several minutes:

Test FreeSWITCH™!

Updating FreeSWITCH™

FreeSWITCH™ may occasionally require updating due to new features, fixes, etc. To update current production, download and install the latest maintenance level.

To update master or the current branch, download the latest updates, compile FreeSWITCH™ and create updated runtime binaries, run the following two commands:

cd /usr/local/src/freeswitch
git pull && make current

Updating Prerequisites

To update Homebrew and its formulas run "brew update" in Terminal, this should be run prior to upgrading packages. To upgrade all packages, run "brew upgrade", or to upgrade a single package run "brew upgrade package-name" command.

Removal

Removing FreeSWITCH™

Consider backing up modified or new configuration files you created! FreeSWITCH™ is completely removed by deleting the /usr/local/freeswitch and /usr/local/src/freeswitch directories using the Finder (drag to trash) or in Terminal:

rm -r /usr/local/freeswitch
rm -r /usr/local/src/freeswitch

Remove Homebrew and Prerequisites

Packages installed by Homebrew are listed using the "brew list" command. They are removed using the "brew uninstall package-name" command. To remove packages and Homebrew run the following in Terminal:

Remove Xcode

Xcode is installed as an macOS package (directory) that looks like a single application file. To remove Xcode drag the application to the trash, empty it and restart macOS.

Remove Everything Else

If the /usr/local directory existed prior to using this procedure it has to be examined to determine if the contents are deletable. If the instructions on this page were followed, and the /usr/local directory was created during this procedure, everything can be removed to roll back the system prior to using this procedure by performing these steps:

Drag everything in the /usr/local directory to the trash. Or delete it in Terminal (macOS prompts for the administrator password):