Try typing ls -G
in terminal, you should see colored listings by file type. If the scripts aren't being shown in a different color, this means that they are not marked as executable, so you will need to type sudo chmod +x <filename>
to make them so. Then they should appear in a different color as opposed to directorys etc.
If you prefer not to always type ls -G then you can put the following command in your .bashrc
file in your home directory alias "ls"="ls -G"
Then restart terminal and you should see colored output whenever you just type ls
I went through the exact same process back when I was playing around with logKext. The unix command you may want to explore is /usr/bin/expect.
It can get complex quickly, but basically what it does is act as a mediator between you and the programs you're running so it can provide answers that you would normally have to type. As an example, I built this script so I could automate the process of printing the logKext output. You should recognize all of the commands you'd normally type to logkextClient yourself...
#!/usr/bin/expect -f
spawn logkextClient
expect "logKext Password:"
send "mylogkextpassword\r"
expect "logKextClient > "
send "print\r"
expect "logKextClient > "
send "quit\r"
close
Back in 10.5 and 10.6 this worked well for me for outputting the logKext print so I could pipe it into an email and send it. However, I was running this logged in as root to terminal, so it was simple.
Theoretically, if you weren't logged in as root, you could instead say
#!/usr/bin/expect -f
spawn sudo -k logkextClient
expect "Password:"
send “myrootpassword\r”
expect "logKext Password:"
send "mylogkextpassword\r"
expect "logKextClient > "
send "print\r"
expect "logKextClient > "
send "quit\r"
close
(note that I used sudo -k
intentionally to be consistent and require a password every time)
So you could use your favorite command line editor to create this script, do a chmod +x
to it and drag it to the dock for launching... Theoretically.
But I have been having problems in Mavericks getting /usr/bin/expect to behave properly with sudo, so this isn't working for me in other scripts like it should. And I don't have logKext installed at all anymore for testing anyway.
But I think this is the direction you may want to head.
Good luck!
Best Answer
You should be able to do the same as your were doing in Linux in macOS.
As an example, if using
bash
, addingto your
.bash_profile
file will let you just typevscode
in Terminal to open Visual Studio Code.Note: If you are running macOS Catalina, or later, and have not installed a more recent version of
bash
and are using the defaultzsh
shell, then putaliases
in your~/.zprofile
, or the appropriate file for the shell you are running.Also, you might want to read Visual Studio Code on macOS to add the
code
executable to yourPATH
orpath
, depending on your shell.