Oct 25 2018 | 1:18 pm
    This first post will always contain a link to the latest version of shell.
    Shell is a cross-platform object for Max with which you can execute terminal commands. The shell object spawns a new shell process, executes the desired commands and passes stdout (and optionally stderr) back to Max. Latest version: Release notes (1.0b2): - OSX: @forkmode now permits switching between fork (default, SSH-compatible) and vfork (better performance under some circumstances) - OSX: SSH works again (if using fork(), see above) - Windows: fixes for single-byte code pages on non-ANSI systems - Windows: Fix for incomplete (prompt) output for Unicode commands. Release notes (1.0b1): - c++11 rewrite (no functional change) - OSX: change fork() to vfork() to improve performance and minimize interruption when forking. - OSX: reset signal masks in the forked process - update Windows projects for Visual Studio 2015

    • Dec 31 2018 | 2:38 pm
      Thanks for keeping this object alive Jeremy, was just wondering why some of my old patches weren't working until I figured out that didn't support 64-bit CPUs.
      Anyway, thought I'd point out that I came across this page via which links to the old forum thread first. Nearly downloaded the 2017 version until I decided to skim through the whole page first and found the link to here. Might be worth updating the links :)
    • Dec 31 2018 | 4:49 pm
      thanks for the note, I've updated the link on the tool page.
    • Jan 08 2019 | 9:57 am
      Does anyone know how to close/quit a specific application or file that is currently open? Via shell (or otherwise if possible).
      I'm on windows and I'm able to open the file or application via shell by just sending the directory of it to shell, but would like to be able to close it as well. Tried pkill but that does not seem to take extra arguments.
      Any ideas?
    • Jan 09 2019 | 8:11 am
      taskkill or tskill is windows equivalent of unix pkill
      To forcefully kill only this process
      taskkill /IM SomeApp.exe /F To forcefully kill this process and any child processes started by it taskkill /IM SomeApp.exe /T /F
    • Jan 10 2019 | 8:20 pm
      Thank's for this beautiful object ! On os x 10.13 ssh doesn't work (on my computer) but on my other computer 10.9 it works fine any ideas ? Thank's
    • Jan 28 2019 | 12:19 pm
      Thanks for the great and highly useful shell object. On Win 10, shell.mxe64 (as of Oct 25 2018) in Max8.0.2 cannot be used on systems set to Asian languages when commands return Asian characters, though. For example on Korean systems: $ ipconfig /all crashes Max reliably as the returned data contains Korean characters. The 20170717 shell version behaves the same, as does shell.2018 on Japanese localizations. Looking into this would be highly appreciated.
    • Feb 14 2019 | 6:21 am
      Hi all, Did anyone on Windows try to control other programming languages from the new shell object?
      I develop a pedagogical package called MOZLib, dedicated to computer aided composition and that works as an introduction to the bach & cage packages A big part of it uses SBCL ( to reactualize composition techniques developed on PatchWork, OpenMusic and PWGL in the 1980s-2000s. It work beautifully on Mac, but I never had the occasion to test it on PC since Windows 10.
      If someone is interested to give me a hand with this, it would be fantastic. I'm planning for a first release around April.
    • Feb 14 2019 | 8:18 am
      Anyone on OSX who is having SSH issues, please try this version:
      There is a new attribute @forkmode. For the previous release, shell was forking with 'vfork' in order to eliminate CPU spikes encountered in (for instance) Live when executing certain kinds of scripts. 'vfork' is useful for this, but disables SIGTTOU and SIGTTIN signals in the child process which are used for interactive input in ssh. You can now select either 'fork' (default, works with ssh) or 'vfork' (less overhead when forking, won't work for ssh), and because it's an attribute, you can change it on the fly depending on your needs.
      For in-box usage, @forkmode 0 = fork, @forkmode 1 = vfork.
      This is OSX-only (the attribute is invisible on Windows and has no effect). If I can get some feedback, I'll roll the changes into an updated release above.
    • Feb 15 2019 | 9:35 am
      Coming back to the difficulties using shell on Win10 with Asian character sets which should be resolved asap. Setting Win10 to e.g. Korean (and back) is just 2 steps: - in Win10 Settings/Time&Language, select Region&language, click Add a language, select Korean, in the Korean field click the Options button and DL the typing pack, click Set as default - right-click the Start menu, open Powershell in Admin mode, type "Set-WinSystemLocale ko-KR" - reboot - in command type e.g. "ipconfig /all"; you should see Asian characters in the output - open shell.maxhelp and send the same command, over here Max8 crashes - to get back to English: in Win10 Settings select English, click Set as default - open Powershell in Admin mode, type "Set-WinSystemLocale en-US" - reboot Thanks for setting this straight.
    • Feb 15 2019 | 9:42 am
      Torsten, it's a free, unsupported and (if you want to try figuring it out yourself) open-source external. I certainly understand your frustration, but it will be resolved when there's time to devote to setting up a system for korean and figuring out the problem. A much more common and pressing issue -- broken SSH on OSX -- took a couple of months to get around to, so thanks for your patience.
      That all said, thanks for the reproduction steps, which will help with the above. Not sure when I'll be able to look at it, though.
    • Feb 15 2019 | 9:51 am
      Sure, perfectly understood. Thanks again for the great object and your support.
    • Feb 19 2019 | 1:59 pm
      @torsten, please test and let me know how it goes. Turned out to be a pretty annoying issue involving non-Unicode, single-bytes Windows code pages (charsets). Seems to be working for me now.
    • Feb 19 2019 | 3:25 pm
      Tested shell_win_190219.mxe64 on Win10. - shell works on en-US system as before - when set to ko-KR (Korean) as described above shell processes Asian characters without the slightest hitch - tested commands: ipconfig /all, arp -a, getmac, ping /n 1 localhost
      Thanks, Jeremy!
      - of no significance, just for the record, sending the command "date" to shell prints the output twice; then shell does not react to any further commands. Same behavior on both Win10 en-US and ko-KR. And same behavior as in the previous (1.0b1) version of shell.
    • Feb 19 2019 | 3:54 pm
      @torsten, good call on 'date', there was a bug in handling incomplete (e.g. prompt) lines in Unicode output. Will be fixed in the next one, which will be posted to github momentarily.
    • Feb 28 2019 | 11:01 pm
      Long shot, but did anyone figure out how to use virtual environment with Python under shell?
    • Apr 26 2019 | 11:03 am
      I've been trying to trigger some npm code which works fine in Terminal, but I get no response in shell. Might there be some issue where I have to load dependencies or something (it works from scratch in Terminal)?
    • May 31 2019 | 7:31 pm
      how would I form a message if I need to send my user password to shell? RTFM link is fine, too.
    • Jun 01 2019 | 6:09 am
      example on OSX echo 'pass' | sudo -S mkdir ~/AAA
      That will make folder named AAA on desktop with admin pass pass is Your password | between pass and sudo is vertical slash , ascii 124
    • Jun 01 2019 | 9:43 am
      thanks, creating a directory works. would you know why this doesn't work for me: echo 'password' | sudo spctl --master-disable i also tried: sudo spctl --master-disable and then in a separate message: echo 'password'
    • Jun 01 2019 | 12:00 pm
      try : echo 'pass' | sudo -S spctl --master-disable
    • Jun 01 2019 | 12:06 pm
      didnt work
    • Jun 06 2019 | 1:49 pm
      I had no High Sierra at hand to confirm that above message to shell works, but now I tested it and it works as expected. Enabling / disabling gatekeeper works. So You must have some other problem. I used last published shell version at the top of this thread.
    • Jun 06 2019 | 2:37 pm
      ok good to know. i will find it eventually. it'll just take some time as i am a terminal dork. i will report my findings.
    • Jun 06 2019 | 2:43 pm
      Maybe You have system integrity protection (SIP) enabled ? You can test things using Terminal first, and if it works there, than it should also in shell.
    • Jun 06 2019 | 2:47 pm
      helvete-6:~ pureold$ csrutil status System Integrity Protection status: enabled.
      'spctl --master-disable' alwaysworks in the terminal but not through shell. I haven't found the right way to send my pwd and 'spctl --master-disable' in one message to the shell.
    • Jun 06 2019 | 3:07 pm
      if password is AAA123
      echo 'AAA123' | sudo -S spctl --master-disable
      This works for me
    • Jun 06 2019 | 3:37 pm
      this is precisely what doesn't work for me. that's my problem
    • Jun 06 2019 | 4:01 pm
      I can't explain it, I do have SIP disabled though, but I don't think that turning gatekeeper off requires SIP to be disabled.
    • Jun 07 2019 | 6:39 am
      This is working for me, and is no different than what you're trying to do.
      $ csrutil status
      System Integrity Protection status: enabled.
    • Jun 07 2019 | 7:59 am
      What has to be mentioned is that if one sends sudo message to shell without providing the password, shell will wait forever for the password input, and will not execute any commands. One has to close and reopen patch, sometimes even restart max to get it going again. To confirm that password is set correctly send this to shell: echo 'pass' | sudo -S whoami ( put correct password in) should output root message whoami should output user name ---------- Is the password the problem ? Try temporary changing the password to something simple, like a single letter, just to make sure, and avoid spaces. And don't use terminal and max with shell at same time. sudo -K command can be used in terminal to clear password cache which gets stored after initial entry for a limited time. Don't know what else to suggest to troubleshoot the problem
    • Aug 09 2019 | 2:52 pm
      Hi Jeremy! Great work with this shell object! Really saved my day :) I would simply suggest an update: adding alias. I was trying to run this in order to test something like firmware updates directly from a Max patch. Using the alias method on the shell was simply not reacting (no errors, but also not uploading the arduino file). I was able to do it replacing the alias with the file path. Although this is fine for me, I can imagine some people running into troubles if they have huge file paths for their implementations. Anyway...great job! Thank you
    • Aug 09 2019 | 8:21 pm
      Hi, every time you send a command to 'shell', it's creating a new login shell, so you don't have persistence (or crosstalk, if you like) between invocations. You can probably add that alias to your .bashrc such that it works every time you use 'shell', although I haven't tested it. Glad the object is working for you!
    • Sep 08 2019 | 1:51 pm
      Hello, I'm trying to launch some Processing patches via the shell object using the command line installation of Processing. However, the shell object shows no reaction to the command "processing-java" or to full commands like "processing-java --sketch=<filepath> --run". It also didn't print anything in reaction to "processing-java --help". All other commands have been working fine ("echo", "pwd", etc. all printed expected results). The workaround that I thought of was to store the processing launch command in a .sh file, and launch the .sh via the shell object, but I can't seem to get any .sh files to launch either. Any recommendations on what to look into? Is this even possible via the shell object? This object has otherwise served me very well in the past! Thanks
      EDIT-September 9: Okay, I think the main issue was message formatting in Max. I've gotten shell to successfully launch shell scripts by opening them in Terminal. (open -a Terminal \"<>\") passed as a message into shell opens a terminal window and runs the script. Not a perfect solution but it works. Another possibility is to export all of the Processing sketches as applications, and launch them using the "open" command in a similar way.
    • Oct 24 2019 | 8:44 am
      HI Jeremy- i am trying to us the shell object to convert some video files automatically in Max - and when i feed the following line into a terminal window (on a mac) - it works fine - but when i try this ins MAX then i get no response - and for the life of me i cant figure out why... does shell not work with ffmpeg? or is there some other reason that i just dont see? i am passing the following line as a message to the shell object: ffmpeg -i /Users/OP/Desktop/Top_View_Camera/20191024_S3_EQ_OHD_Trial01.mkv -vcodec copy -acodec copy /Users/OP/Desktop/Top_View_Camera/20191024_S3_EQ_OHD_Trial01.mp4 any suggestions are greatly appreciated ! thx
    • Oct 24 2019 | 8:50 am
      send full path to ffmpeg binary to shell. And use slash based path.
    • Oct 24 2019 | 11:07 pm
      Thank you Source Audio! ;) solved my problem! ;) greatly appreciated!!
    • Oct 29 2019 | 9:30 am
      now i do have another question that i cant seem to solve: shell is calling a new terminal session each time a message is sent to it - i get that -this means that i cant call a for loop in terminal as a usually would since each line would call a new terminal. if i want to convert the above mentioned mkv videos to Mp4 videos - then i was thinking i could (since the number of videos created will vary dependent on the numbers of trials) read the folder with the folder object and then selected ONLY the mkv flies to process - but i cant seem to find how to filter the list only to *.mkv - the selectable type does not include mkv file - so how do i just search for a text tring and use that as filter ? the individual names of the file wikll change of course - so i want to pass each individual file name to the shell object for conversion via ffmpeg. what am i missing?
    • Oct 29 2019 | 10:16 am
      You need to add .mkv filetype to Max filetypes in order to be able to filter that type of file in umenu autopopulate, dropfile filetype etc. Either add a line in max-fileformats.txt which is the best option, max fileformat .mkv MKVF 0 Video moviefile; or by loadbanging a message : ; max fileformat .mkv MKVF What I don't know what 4 char id should be used for that type of file, maybe MKVF would do. Adding a line in max-formats.txt is a better option, because it will work form the first max start. Doing this by message from max standalone, would need standalone restart to make new filetype active.
    • Oct 29 2019 | 10:18 am
      P.S. of course You could build a full list of found items, and then copy only *.mkv files to a new list, doing some regex or similar, but that's not prefered way.
    • Oct 29 2019 | 10:19 am
      Hey Source Audio - great - did not know that i could edit the list of file types - i will try that! ;)
    • Nov 02 2019 | 7:03 pm
      Another simpler question.... how to send the press ENTER request appearing in the max Console?? penter alone doesn't work... Thx - Italo
    • Nov 03 2019 | 8:22 am
      penter needs a password entered. man perl needs no password . I don't know what exactly You are trying to do. If You send any message that requests password, You send penter xy, xy = password.
    • Nov 03 2019 | 11:38 am
      @keepsound 'penter' is working for me with the perl docs, or man pages in general.
    • Nov 03 2019 | 10:07 pm
      Hi, first of all, many thanks for your answers and interest. @source audio: I don't have to send passwords and I know how to do it. Here I have only to send ENTER (I guess penter, and it's not working. I'm not speaking about Pearl but about Man and what is then coming out to the Max Console @Jeremy: penter alone is not working for me with man (I've write man Pearl as example, can be any, man cp, man mkdir, man rm etc). In the Terminal window the info is complete, in Max you have to send ENTER to show the next row.
      Most of all I need a url with more infos about penter, but there's not any....
    • Nov 04 2019 | 2:05 am
      Found by myself, maybe can be useful for anyone: send a argument to the shell obj as "stderr 1", then penter will work. See picture
    • Nov 04 2019 | 10:15 am
      Fine that it finally works for You. I am using older version of shell (2017) max and OS. It works differently than new one, and also depends on OS. So as You say, one has to try & error till it does what one wants.
    • Nov 04 2019 | 12:26 pm
      Yes, you can download the new vers too. The new vers is 8.0.0 and works also on older Max and OS versions.
    • Jan 09 2020 | 11:41 pm
      I am trying to retrieve the name of the wifi network i am connected with through [shell]. this command works in the terminal: /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk -F: '/ SSID/{print $2}' sending this message into the shell object gives me back "0". does anyone know what I am doing wrong?
    • Jan 10 2020 | 7:54 am
      Try this :
    • Jan 10 2020 | 8:29 am
      @source audio your patch gives me this: print: agrCtlRSSI: print: agrExtRSSI: print: agrCtlNoise: print: agrExtNoise: print: state: print: op print: lastTxRate: print: maxRate: print: lastAssocStatus: print: 802.110000 print: link print: BSSID: print: SSID: print: MCS: print: channel: but no info. OSX 10.13.4 i am connected to an android 6 phone hotspot right now. will try at home later.
    • Jan 10 2020 | 8:39 am
      I am having clear output with all values, but I run it on snow leopard.
    • Jan 10 2020 | 8:57 am
      you are on 10.6??? wow.... it seems that [shell] is often not accepting the same messages as the terminal although it is supposed to do so. is there any place where i can read/learn about this?
    • Jan 10 2020 | 9:02 am
      • Thanks again for the great object and your support.
    • Jan 10 2020 | 9:13 am
      /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk -F: '/ SSID/{print \$2}' works for me. You need to escape the $ in $2 because $2 is a reserved term in message box.
    • Jan 10 2020 | 9:16 am
      sending "/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I" in the terminal gives me all the info
    • Jan 10 2020 | 9:19 am
      "success"!!!! i found an older [shell] from 17 july 2017 (version 7.3.4) which does work! let's hope we caught jeremy's attention by now to get a fix or at least an explanation =)
    • Jan 10 2020 | 9:24 am
      @jeremy - read your post too late.... i tried with shell 8.0.0 and it works! thanks for the help.
      can the same thing be done with shell on windows? probably needs a completely different message?
    • Jan 10 2020 | 9:28 am
      OK, the problem in @Source Audio's patch is that shell outputs its result as a list (it used to output each line as a single symbol in the past, you can re-enable that behavior with the @symout). So the data is being altered by fromsymbol (which only reads the first item in the list and ignores the 2nd item (the name you want)).
      The awk issue is the escaped $, as I mentioned earlier.
      So this works for me, and should work for you:
      As for Windows, well, that's what the internet's for, right? I used an obscure tool called Google and found: . You'll need to try it yourself, though.
    • Jan 10 2020 | 9:35 am
      yeah - i just figured out the tosymbol trap in source audio's patch this very second. google is indeed an interesting tool. thanks for bringing it to my attention. will give it a try soon and report back if it's useful for anything at all!
    • Jan 10 2020 | 9:48 am
      What makes it a bit difficult is that both shell version and OS version come into play, so one needs to experiment a bit to get the wished result. Inserting print or capture is allways helpfull to find out what's going on. in older shell escaping \$2 simply does not work ...
    • May 23 2020 | 10:43 pm
      This is a question mostly for Jeremy, but anyone who has an idea is very welcome ! As I wrote already before on this page I use the shell object intensively for 5 years now, to evaluate Lisp code generated on the fly in Max (+ bach) with SBCL. It works beautifully (and extremely fast), thank you so much again Jeremy for keeping the project alive, I really depend on it ! :) Now the system I call PWforMax is part of my main research project, and distributed freely inside the MOZ'Lib package for computer-aided / algorithmic composition : My question concerns performance of the shell object when printing from stdout and/or stderr to the Max window. I am now porting to Max a powerful, polyphonic music constraint solver (written in Lisp by Örjan Sandred) that in a certain debug/verbose mode prints every n cycles of a search to stdout. This is very useful to identify where and why the solver would struggle to return a result with specific search-space and rules. I noticed in that case that the shell object seems to struggle and return those printed messages kind of all at the same time (by grapes of 60 lines every 5 to 15 seconds), sometimes it even waits until the end of evaluation before returning anything. In pure lisp, from the terminal, it prints everything at constant pace, which is a bit more readable.
      Any idea why? I imagine this might be a "feature" or voluntary limitation (like a speedlim...) in the bridge between Max and shell? This is very much a cosmetic problem, it looks clunky but does the job VERY well :)
      Thanks for the help ! All the best,