Search code examples
pythonmacosautomationsikuli

Can't run SikuliX scripts from Command Line (Mac)


I'm using MacOS 10.11.6. According to the instructions here, I should have a command runsikulix available, but I don't. (Should it be available after installing? Or do I need to set the variable myself? I couldn't find any explanation). So I tried the following, hoping it would work:

I wrote a SikuliX script that works when running from the IDE, and tried running it with the command line as follows:

open ./Applications/SikuliX.app -r ./agilent/test.sikuli

and I got this response:

open: invalid option -- r

Without the file argument, the IDE opens. Can anyone give me a pointer on how to run a file? Thanks.


Solution

  • This just worked for me in the Terminal (Note that I have the Sikuli app in its own folder inside the Applications folder):

    java -jar /Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar -r '/Applications/Sikuli/Sikuli_Stuff/test1-about.sikuli/'
    

    [EDIT on May 11, 2020]

    The path to the java JRE can get frustratingly obtuse in OSX. I recently was beset by "Unsupported major.minor version" errors when using the old java path, so I had to track down the newer runtime environment binary, which is now in

    /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java

    So in order to make this work (again), I had to specify the path to this newer JRE. The new command line looks like:

    /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -jar /Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar -r '/Applications/Sikuli/Sikuli_Stuff/test1-about.sikuli/'
    

    And one may alias a link to this new RE as described in Mac OSX Java Terminal version incorrect