recent posts related to the mac os x operating system
I don’t remember where I first found this line of code, but if you put it in your Mac OS X ~/.bash_profile file, it’s an easy way to set your Mac Java version:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
I can confirm this works with the Bash shell on Mac OS X 10.10. When I run the
java -version command after opening a new Mac Terminal window, the output is
A slightly more difficult way to set your Mac Java version is to look under the /Library/Java/JavaVirtualMachines directory to see which versions are installed, and then manually set the version.
I’m currently generating my new book on “functional programming in Scala” as a PDF using a combination of Pandoc and LaTeX, and as a result it feels like I’m opening the same PDF file about 100 times a day.
When using iTerm2, if you’re editing a file with vim and want to jump to a specific location in the file using a mouse click, just hold down the [Option] key when you do a normal left mouse click. That will take you to the location directly under the mouse cursor. (Unless the mouse cursor is beyond the end of the line. In that case the text cursor will be moved to the end of that line.)
I mention vim here because I just learned about this when using vim, but you should be able to use this with any app when using iTerm2. This is an iTerm2 feature (not a vim feature).
As a quick note, this URL shared a script to list all of the LuaLaTeX font names, and it almost worked for me.
As a quick note to self, I just created a TextMate Bundle snippet to insert some text at the current cursor position. Using TextMate 2.0.x, I did it with the following steps. I’ll go through these steps quickly as I’m just writing this for myself:
If you use MacTex to install
pdflatex and all other LaTeX commands, as of mid-2016, the MacTex installation path is:
This means that the
pdflatex commands will be at /usr/texbin/pdflatex, and so on.
If you’ve never used AppleScript, here are two iTunes AppleScript examples to get you going. First, This one tells iTunes to play the playlist named “My Favorites”:
tell application "iTunes" play playlist "My Favorites" end tell
That script starts playing a random song from that playlist. If you want to start by playing the first song of that playlist, this script will do the trick:
I recently bought a new iMac, and it came with a “Magic Mouse 2,” which is like the original Magic Mouse, but this one has a built-in battery. (It would have been nice if the documentation mentioned that, but that’s another story.) Once I figured out that you could charge it, I quickly wondered, “How long do you need to charge the Magic Mouse 2?”
find . -name '*.mp3' -type f -mtime -365 -print0 | xargs -0 tar rvf ~/iTunesBackup.20150118.tar
The way this works is that I move into the Music folder on my OS X system, then run that command, and it creates the tar file shown at the end of the command. This command copies all *.mp3 files that are under the Music folder that have been modified in the last 365 days into the resulting tar file. If you have files other than MP3 files that you want to back up, or if you want to change the date range of the backup file created, just change (or remove) those options in the
find command. Note that the
-print0 option is needed to back up filenames and directories that contain blank spaces. (See my Unix/Linux find command examples for many more
find command examples.)