Linux : using BASH to open SCIDE and execute a file automatically?


Couldn’t find any answer to this on the internet, so does anyone know how to open scide from the shell and then execute a file automatically in the IDE context ?

I’m setting up my DAW, so I’m using a BASH script to open processes : Jack, QJackCtl, scide, Ardour5, Japa…

Regarding scide, I’d like to have a file executing at startup, booting the server and starting to load my libraries, synthdefs, etc. But I don’t want it to be the general startup file, so that if I’m not calling scide from this BASH script, this file don’t execute.

scide file.scd opens the IDE and loads the file, but doesn’t execute it.

scide & sclang file.scd execute the file but doesn’t ‘boot’ the IDE…

At least, loading the file automatically allows to execute it quickly, but I’d rather automate whatever I can.

Has anyone figured out how to do this ?

Many thanks, Simon

Yes, kinda, not with the IDE, though, with vim.
I can walk you through that if you think that’ll be helpful.

Ok thanks !

Except if anyone else wants it, I don’t really need documentation about this process here, as I don’t plan to use vim for now, as I’m not comfortable with ‘old school’ IDEs. I think I can find the process on the scvim github page if I plan to switch to it.

There’s an autorun feature – Document | SuperCollider 3.12.2 Help – that might help you here.


1 Like

For vim, you essentially need two things - a bash script that’ll start up vim and your environment, and a vimscript that’ll load and execute an SCD file.

Both of these are essentially executing commands you otherwise would do by hand:

my bash (environment variables are to keep the project local):


# Get the Project Directory - from
export PROJECT_DIRECTORY="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

# Get the user Supercollider Quarks Directory
export USER=`whoami`
export QUARKS_DIRECTORY="/home/${USER}/.local/share/SuperCollider/sketchpad-downloaded-quarks"
export QUARKS_DIRECTORY_SED=$(echo $QUARKS_DIRECTORY | sed 's_/_\\/_g')


# Get local extension/classes directory
export LOCAL_EXTENSION_DIRECTORY=${PROJECT_DIRECTORY}/supercollider/extensions

# Get local plugins (UGen Objects) directory
export SYSTEM_PLUGINS_DIRECTORY="/usr/lib64/SuperCollider/plugins/"

# Go to the project directory so all relative paths are appropriately set

# Generate the YAML Configuration File
export YAML_CONFIG="/tmp/supercollider_sketchpad.yaml"
cp conf_base.yaml $YAML_CONFIG

# Generate the vim syntax and tags directories
mkdir -p ${SCNVIM_TAGS_DIRECTORY}/scnvim-data
mkdir -p ${SCNVIM_TAGS_DIRECTORY}/syntax


# Source the vim environment bootstrap when neovim starts
/usr/bin/nvim -c ":source environment.vim"

my "environment.vim:

" Startup File that's very specific to the environment and files that live
" within the project. It's not the best, but it gets the workspace into
" a place where it's ready to make sound, and it does so in a local and
" reproducable way.


" TODO: Ensure that the yaml file handles the relative path
let g:scnvim_sclang_options = ['-l', $YAML_CONFIG]
let g:scnvim_root_dir=$SCNVIM_TAGS_DIRECTORY

" Ex Commands to Start Environment After NVim Startup
function! LoadEnvironment(timer)
    :args ./supercollider/

    :call tagbar#CloseWindow()

    " Initialize SuperCollider
    :0 " Go to the first line in the startup file (hacky)
    :call scnvim#sclang#open()
    :call scnvim#send_block()
    ":call scnvim#postwindow#close()

    :sleep 250m "Wait for flicker to finish

    " Run the Command to Organize the SuperCollider Status Windows
    :silent !./

    " Run the Command to Connect Baudline to Supercollider
    ":silent !./

    " Generate tags for the environment


" Function to Wait for NVim Startup
function! WaitForLoad()
    let timer = timer_start(50, 'LoadEnvironment')

:call WaitForLoad()

Haven’t published this for public consumption yet, but it should give the gist


And obviously this can be extended to connect audio recording/kill the process after a few minutes/etc.

Again… If vim is too complex for this task, the IDE autorun feature works like this: write a comment /*RUN*/ at the top of your document. When it’s opened in the IDE (or after recompiling the library), it should execute the whole file.

I believe this would be simpler than the script, but I’m not sure which one really suits your use case better.


1 Like


For this use case, I think that is 100% the right solution.
I was posting mine in case it would be helpful for others who were previously in my situation.

Sure – it’s definitely helpful to have the script template for vim users!

I was just puzzled in this case because the original poster said “I’d rather not use vim” but then overlooked an IDE solution in favor of a vim solution… so I thought it might be worth a second post.


1 Like

Sorry for confusing things! I was replying to “Except if anyone else wants it” and just ran with it. :slight_smile:

I guess using vim is definitely the right solution here, as the /*RUN*/ tip, even though it’s really powerful, is similar to the startup file, and is conflicting with the Session system, which I set up as “load last session”, and would cause the script to run whenever I start SCide without having it closed the last session.

Anyway, executing the script manually isn’t that time consuming =) . I’ll take a look at vim asap.

Thanks for your answers.

Another option might be to start Vim in Tmux (with tmuxp). Then you can setup a yaml config file, which does the work for you. But Bash might be the most obvious shot.
There a quite some tools on Linux to save and restore JACK connections, but you could also use this quark I think:

See also: GitHub - madskjeldgaard/linuxutils-quark: Supercollider convenience functions for interfacing with Linux Audio utilities

I have two options to load my scd and start sclang from the CLI. These can both be added to the .profile file to start at startup. I would probably suggest a sleep, so that everything has loaded before starting sclang.

export QT_QPA_PLATFORM=offscreen
sclang .config/SuperCollider/startup.scd

and using xvfb…

xvfb-run sclang .config/SuperCollider/startup.scd

They both now work for me. I have not quite worked out which is best or most efficient as I just wanted a working solution.