Mac OS X: editing ~/.bash_profile using TextEdit
Posted by jpluimers on 2013/05/10
Finder on your Mac by default does not show hidden files, and the console has vi, which lots of people find awkward to use.
There is an easy trick to open a hidden file like ~/.bash_profile
(for instance to add an alias) with a visual text editor.
Just execute this in your terminal:
- Always with TextEdit
open -e ~/.bash_profile
- For the default text editor (usually TextEdit)
open -t ~/.bash_profile
- For a specific text editor (in this cast TextWrangler)
open -b com.barebones.textwrangler ~/.bash_profile
The man open(1) page has more information on the parameters you can pass to open.
–jeroen
PS: You can teach Finder to Quickly show and hide hidden files | Finder, Terminal | Mac OS X Tips.
2014 and VMware Fusion has still no built-in “Clone this VM”. Workaround from VMware Communities « The Wiert Corner – irregular stream of stuff said
[…] I do moste of the editing from the console, and used this trick to edit text files from the console. […]
Mac OS X: How do you run JavaScript script through the Terminal? (via: Stack Overflow) « The Wiert Corner – irregular stream of stuff said
[…] Now I have these aliases in my ~/.bash_profile: […]
Ruurd Pels said
TextEdit… Anybody that wants to edit their bash profile should be in a stage where they either should use TextMate or Sublime Text. And then it’s easy as mate .bash_profile or subl .bash_profile. That said: you migh want to have a look at brew and install nano for command line editing.
jpluimers said
On the command-line, I’m used to pico or joe (because of my Linux and WordStar background).
I’m still expanding the toolbox on my Mac.
Will look into TextMate and Sublime Text.
BTW: from what I have used so far, I do like TextWrangler.
Ruurd Pels said
Found TextWrangler so so. Like TextMate more. Sublime is excellent too but rather expensive.
Absolutely indispensible: Alfred, TextExpander and Hazel
Very nice to pimp your desktop: Geektool
Toolbox I have: MonoSnap, Bartender, Pomodori, Palua, You Control Tunes, Cobook, Day One, QuickCal, ClipMenu, Popclip, Liquid Pro, Freeman, Bulb
Regular used apps: Things, Taskpaper, Pocket née Read Later, Notebook, MarsEdit, EasyBooks, Soulver, Rubymine, IntelliJ, Coda (VERY VERY NICE), Codekit, MultiMarkdown Composer, TextMate, Sublime Text 2, Dash, SourceTree, Kaleidoscope, Sequel Pro, Pages/Numbers/Keynote, MindNode Pro, SketchBook 6 Pro, LibreOffice
jpluimers said
Thanks!