Panorama allows you to embed code written in Perl, PHP, Python and Ruby into Panorama code. However, in recent versions of macOS these languages are no longer included as part of macOS. In that case, you'll need to install the language you want to use yourself. Or even if the language you want to use is already installed, you may want to install a newer version (Apple tends to include older, somewhat obsolete versions). Once you've installed the version you want, you can configure Panorama to use that version.

Installing Scripting Languages

It’s possible to install scripting languages manually, but an easier method is to use a package manager. The most popular package managers available on macOS are Homebrew and MacPorts.

Both of these package managers have installation packages for all four of the scripting languages that Panorama supports. Pick the package manager that you want to use, then follow the package manager instructions to install the language(s) you want to use.

Default Configuration

By default, Panorama will use the scripting language built in to macOS, if any. So if you’re using a version of macOS that includes the language you want to use, no configuration is necessary.

If macOS doesn’t include a particular scripting language, Panorama will look for that language in the default installation location used by Homebrew:

/opt/homebrew/bin/

If the language isn’t found there, Panorama will look in the default installation location used by MacPorts:

/opt/local/bin

So in most cases no configuration is needed at all – Panorama will automatically find the language for you.

Custom Configuration

If you’ve installed a scripting language in a non-default location, or if you have multiple copies of a scripting language installed and you want to specify which one to use, you’ll need to set up a custom configuation. This is done by opening the Preferences window and then switching to the Advanced tab.

The Scripting Languaged panel contains two sections. The top section displays a table showing the status of the languages that Panorama is currently configured to use.

The first column of this table lists the four languages in alphabetical order.

The second column of the table lists the version number of this language. If the version number is empty, the language isn’t installed.

The third column of the table shows the location of the configured language.

Custom Paths for Scripting Languages

If you want to use a scripting language in a non-default location, you’ll need to type the location into the Custom paths box. If you have custom paths for more than one language, it doesn’t matter what order you type them in. (However, if you type in two or more different paths for a single language, only the first path will be used.)

In this example, both Python and PHP are using custom configurations. Python has been customized to use Python 3 instead of the default Python 2, and PHP has been configured to use a copy of PHP installed via Homebrew. This copy of PHP is quite a bit newer than the default copy that came with this macOS 11 (Big Sur) system.

When you edit the custom paths, the status display will update as soon as you press the Enter key, so you’ll immediately be able to see if you typed in the correct path.

Customizing Paths in Code

If you want to access the custom paths directly in code, use the Panorama preference PXScriptBinPaths. For example, suppose you had some code you wanted to run using Python3, even if Python 2 is the current configuration. You can force the use of Python 3 with code like this:

let wasCustomPaths = catcherror("",getpreferencevalue("PXScriptBinPaths"))
setpreferencevalues "PXScriptBinPaths","/usr/bin/python3"
let result = python("some...python...3...code...here")
setpreferencevalues "PXScriptBinPaths",wasCustomPaths

Of course this assumes that Python3 is in fact installed on this computer. Remember, this is no longer guaranteed on all versions of macOS.


See Also


History

VersionStatusNotes
10.2NewNew in this version.