Cabbage Logo
Back to Cabbage Site

Distributing plugins on MacOS (Part 1)

This is something that come sup quite a lot. It’s not so straight forward, but I will try to give an overview of how to do this. I will focus on how to embed Csound into the plugin. Packing on OSX can be done with the Packages software. Details on packaging plugins can be found here. You will need to install the xcode command line tools in order to perform the relinking of Csound. You will also need to have some familiarity with the MacOS terminal.

These steps are relevant for Csound 6.15.

Steps to take to bundle Csound into your plugins (don’t forget to replace pluginName and exntension with yours!):

1: export your plugin as usual

2: copy the latest version of the Csound framework into your resources folder (you can remove what you don’t need from it later). It can be reduced in size quite a lot for final distribution. It typically lives in /Library/Frameworks/CsoundLib64.framework

3: Run the following command on the CsoundLib64 binary that is now in your plugin Resources folder. It’s easiest if you cd to pluginName.vst/Contents/Resources/CsoundLib64.framework/ first.

sudo install_name_tool -id "@rpath/CsoundLib64.framework/CsoundLib64" CsoundLib64

4: Then from your plugin binary location, pluginName.vst/Contents/MacOS run:

sudo install_name_tool -change /Library/Frameworks/CsoundLib64.framework/CsoundLib64 @loader_path/../Resources/CsoundLib64.framework/CsoundLib64 pluginName

When these steps are complete, you should be able to run your plugins without an install of Csound. I usually test by renaming the CsoundLib64 framework and testing the plugin with a host.

Finally, I’d recommend PluginVal to test your plugins. And Apple’s own auval tool is great for AUs. To test your AUs with auval you can run the following command:

auval -a

This is more or less the same as running the plugin manager from inside Logic Pro.

1 Like

A quick video tutorial on how this is done!

hi rory - I’ve tried embedding Csound with the .component of exported plugins following the method you’ve demonstrated here, but whenever I ask a friend to test if the plugin works on their sans-Csound device, this error is shown (tested in Logic):

validating Audio Unit graindelay by CabbageAudio:

    AU Validation Tool
    Version: 1.7.0
    Copyright 2003-2019, Apple Inc. All Rights Reserved.
    Specify -h (-help) for command options

--------------------------------------------------
VALIDATING AUDIO UNIT: 'aumf' - 'DGrn' - 'Cabb'
--------------------------------------------------
Manufacturer String: CabbageAudio
AudioUnit Name: graindelay
Component Version: 2.5.17 (0x20511)

* * PASS
--------------------------------------------------
TESTING OPEN TIMES:
COLD:
FATAL ERROR: OpenAComponent: result: -1,0xFFFFFFFF


validation result: couldn’t be opened

The same result has occurred with both example instruments/effects, as well as my own instrument. Strangely enough, if I try to conduct an experiment on my own computer by renaming the original Csound framework (in the Library) like you did in your video, the plugin will still successfully work. Could there maybe be some more steps needed to make this work for devices that have never had any history with installing Csound?

Oh, and just to let you know, the plugin tested above is the example GrainDelay effect.

Do you happen to have any custom builds of Csound installed on your machine?

Nope, I only have what’s included in the installers for CsoundQT and Cabbage.

Can you post the output of otool on the Csound library and the plugin library?

And can you confirm the version number of Csound?

I’m happy to help you sort this out, but it’s late here so I need to sign off for the night. I’ll get back to you tomorrow. The more info you can send on in the meantime the better :+1:

Btw, might be easier if you send me a link to the the plugin. I can run some tests on it

Hi Rory, sorry for putting this off and taking so long to respond to you. I shouldn’t have done that and it won’t happen again.

Here is the output of otool on the Csound library after running the command provided in the original post:

CsoundLib64:
	@rpath/CsoundLib64.framework/CsoundLib64 (compatibility version 6.0.0, current version 0.0.0)
	@loader_path/../../libs/libsndfile.1.dylib (compatibility version 2.0.0, current version 2.28.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
	/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
	/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)

And here is the otool output on the plugin library:

CabbagePlugin:
	/System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit (compatibility version 1.0.0, current version 1.0.0)
	@loader_path/../Resources/CsoundLib64.framework/CsoundLib64 (compatibility version 6.0.0, current version 0.0.0)
	/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
	/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1000.0.0)
	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 162.0.0)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
	/System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/CoreAudioKit.framework/Versions/A/CoreAudioKit (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/CoreMIDI.framework/Versions/A/CoreMIDI (compatibility version 1.0.0, current version 69.0.0)
	/System/Library/Frameworks/DiscRecording.framework/Versions/A/DiscRecording (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0)
	/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 608.3.10)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1894.10.126)
	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 52.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1673.126.0)
	/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1348.12.4)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1069.11.0)
	/System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1673.126.0)
	/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

For some reason it seems that both(?) the library and the plugin are still looking for the Csound library within the user library. If I’m wrong about that do correct me, as I’m not very familiar with this unfortunately…

I can also PM you a link to the .component I’ve run these tests on (it’s McCurdy’s grain delay example) if you’d like.

Yeah, if you can send me the .component that would be good :+1: don’t worry about the delay in responding. We’re all busy!

1 Like

I think you might have been a little overzealous with what you removed from the Csound framework. What you should do is copy and replace your Csound framework, the one in the Resources folder, with your system-wide version. Then do the relink again on that. Don’t remove anything from the copied framework for now. Better to see that the thing is working before you start ripped things out. You can send me the update component, I’m happy to check it here for you. I’ve always found renaming the system-wide Csound framework a good way of testing if the relinking has worked, but I’m certain I only have one Csound version installed on my machine. If you have another version installed anywhere on your machine this test might not work.

Hmm that’s strange - I didn’t remove anything from the Csound framework (I just copy + pasted the framework from /Library/Frameworks/) when I did this. I guess I could try again though

It looks like quite a lot of files were missing. Are you using a standard Csound install? Copying through the finder should work fine.

I tried to test a plugin again today on a computer that hasn’t had any history of Csound installations and still encountered the same error via Logic’s Plugin Manager (after doing the tasks above). I’d recently reinstalled Csound before executing this process again (through the Cabbage installer), so I don’t think it’s an issue with a non-standard Csound install. I also conducted the “rename the CsoundLib64 framework and try running the plugin in a DAW” test on my computer, and for some reason that works fine. To make sure that the plugin wasn’t looking for the renamed Csound framework in the Library I tried to also run a plugin (another Cabbage example) that hadn’t been modified using the steps described above. The un-modified plugin did not work correctly while the modified one did, so at least something is being done correctly.

I’m sorry I keep coming back with another failure to make this work :((

Can you send me on the latest one?

I’m going to ping @hdale94 here because he went through all of this last week without any great issues. Maybe he can provide some extra info that I’ve missed.

I will get back to you later today, and try to post the exact steps I did in order for it to work :+1:

1 Like

First, I installed the part of Xcode that was necessary to run the commands, and then I basically followed the exact steps in Rory’s post, and things worked fine. The places that Rory wrote “pluginName”, I replaced with the name of the exported VST/AU.

Something I got confused by, which maybe have confused you aswell was:

2: copy the latest version of the Csound framework into your resources folder (you can remove what you don’t need from it later). It can be reduced in size quite a lot for final distribution. It typically lives in `/Library/Frameworks/CsoundLib64.framework

At first I didn’t quite understand if it was the folder “CsoundLib64.framework” or the “CsoundLib64”-file that is inside. Anyway, it was the folder as viewed in this image. This is how the “Resources”-folder inside the .au looks like

So I just talked to a friend that was testing a AU for me. He also had some problems opening the plugin as AU-format, and these are the steps he (as a user) did to solve it.

  1. Copy .components file into correct folder.
  2. Restarted computer (Might not be necessary, was just in case)
  3. Got a message that it couldn’t be open (dialogue box in Logic when scanning for plugins)
  4. Went into Settings -> Security & Privacy -> General where it says that macOS denied a developer access
  5. He clicked for it to be allowed anyway and opened Logic and did a rescan where it finally showed up

Thought it might be useful.

Thanks for the insight, @hdale94 - the person I sent my plugin to for testing also encountered the same security message and allowed it through settings, but was still unable to run the plugin in Logic due to whatever error I seem to be making :confused: And thanks for the reminder about copying the CsoundLib64.framework folder. I did do that when I tried going through this, thankfully.

@rorywalsh I’ll PM you the plugin in a bit. It’s busy uploading at the moment.

Here’s a little bash script I wrote that will copy the Csound framework to a plugin bundle, and do the necessary relinking. If you pass it an optional ‘minify’ argument it will also remove lots of unnecessary files from the Csound framework. relink.sh (2.3 KB)

Typical use:

 ./relink.sh ~/Library/Audio/Plug-Ins/VST/SimpleSynth.vst SimpleSynth minify

Note you will need to change the permissions of the file before running it. You can do that by running the following command on the script:

chmod +x relink.sh

p.s. You could further reduce the size of the plugin by removing all opcodes you don’t need from the bundled Csound framework.

1 Like