Setting up aliases.mine for tcsh in OSXYou're beginning to tinker around with the Unix command line in OSX, and you're now at the point where you are feeling frustrated with what seems like repetitive typing of the same commands and parameters again and again (and you have already uncovered the handy up-arrow and tab-complete features). You are now ready to learn more about configuring your shell environment. Unfortunately... So here is what you need to set up, and what you might want to set up. First, this page is exclusively for the tcsh shell on MacOS®. If you want to tinker with sh, csh, bash, zsh or any others, look elsewhere. When OSX was first released, and for the first few iterations, the default shell was tcsh. This was changed to bash when 10.3 (Panther) was released. To enter a tcsh shell from a bash shell, type tcsh at the command line prompt. This script is for the tcsh shell only. Second, you may want to make the user Library folder visible. It's been hidden since MacOS X 10.7 (Lion). The page at https://www.lifewire.com/os-x-is-hiding-your-library-folder-2260833 nicely explains this and how to make it visible. There are many other sites that discuss this. Third, you will need the source files. Apple removed them and basically made it impossible to re-create them. You can download the tcsh.zip archive here. It comes from MacOS 10.6. Unpack/unzip/decompress it and place it in the folder /Users/{username}/Library/applesux (same as ~/Library/applesux) - you will need to create that folder by entering mkdir ~/Library/applesuxAnd then move the tcsh folder into applesux (do you sense my frustration?) If you do this correctly you will be able to view the README file as follows: cat ~/Library/applesux/tcsh/examples/READMEwhich is the same as... cat /Users/{username}/Library/applesux/tcsh/examples/READMEwhere {username} is the short name of your MacOS user. I could have automated this process, but that would have required bringing files in from outside under program control, creating a possible security hole. Doing this part manually gives you control and a chance to inspect what is coming in.So here's the fun stuff... As background, if you enter this into your command line shell (yes, this is insecure pseudocode!): alias ssh1 'ssh myserver.mydomain.com -l myshortname -p mypassword'you will find that you can connect to myserver.mydomain.com by entering only ssh1. What a handy time saver! Unfortunately, when you exit your shell, you lose this shortcut. But there is a solution! The file aliases.mine can hold an arbitrary number of such aliases, which are automatically enabled at login time (tcsh shell only). However, setting it up manually is a bit tedious; the following Applescript does the work for you, and provides a tidy teaching lesson as well. Here is the ScriptBesides setting up aliases.mine, this script also sets pico as the default text editor.To set up aliases.mine, copy and paste the above script into your Applescript Script Editor, compile it, and run it. The script includes several display dialog commands, which allow you to watch, learn, and debug, and to stop the script if something seems awry. It is also helpful to open the Script Editor event log (before running the script!) and check "Show Event Results" to follow the progress of the script. When completed, a Finder alias to aliases.mine will be in your Favorites folder (along with a Finder alias to ~/Library/init/tcsh/), and it should (hopefully) conveniently open in BBEdit. If you have trouble after editing any of the files using BBEdit, be sure to save them using Unix line breaks (there's an "Options" button in the open/save dialog). You can also edit your aliases.mine file by typing myaliases at your command line prompt (in the tcsh shell). You will need to exit your current shell and log in anew before these changes will take effect. The inspiration for this script can be viewed in the terminal with:which will bring up something similar to the following: The above Applescript creates, but does not further modify, completions.mine, rc.mine, and path. This is because this is a work in progress, I have no current need to extend those functions further, and I wanted to keep the script lean and focused on aliases.mine (and I don't know yet what I can do with them anyway). LegacyThis is the pre-MacOSX 10.4 (Tiger) version. It is here only as a historical reference. Don't use it. LinksRe-establishing ~/Library/init/tcsh functionality (2002)CreditsMy thanks to Daniel Woods who helped me debug the problem with /usr/share/tcsh/examples/aliases.© 1997-2022 Jeffrey W Baumann dba LinkedResources. All Rights Reserved. Last Updated December 28, 2021. |