Cabbage Logo
Back to Cabbage Site

Distributing plugins on MacOS

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.

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

	@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:

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