Showing posts with label osx. Show all posts
Showing posts with label osx. Show all posts

Friday, November 13, 2015

updatedb on OSX

Mainly because I always forget, on OSX you can run the script the updates the locate db automatically, just run:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
(you only have to do it once)

Before you do, edit /System/Library/LaunchDaemons/com.apple.locate.plist Get rid of the following portion so that it runs daily instead of just once a week though.

                <key>Weekday</key>
                <integer>6</integer>

Saturday, October 31, 2015

Changing default prefix keys for tmux

tmux uses Ctrl-b as the default command prefix, that's ok on Windows but less than desirable on a MacBook Pro. Turns out that it's super easy to remap to something easier to type, but it's a two-step process.

First, let's get some usage out of the vestigial 'caps lock' key. Go to 'System Preferences' -> 'Keyboard' -> 'Modifier Keys' and then change caps lock to do something (marginally more) useful, the Control key.

Now that that's out of the way, remap the prefix in tmux by editing (or creating) your ~/.tmux.conf file. We only need one line in there to remap the prefix to Ctrl-a (which are handily right next to each other):

set -g prefix C-a

Two things to note: first, changing the caps lock key to be control affects ALL applications on your Mac, if you're like me and never use caps lock, that's probably ok - just something to remember. Secondly, sometimes you might want to be able to send Ctrl-a to an application that you're using inside tmux. If you think you will, just add another line to your ~/.tmux.conf file:

bind C-a send-prefix

This will allow you to send Ctrl-a to the application running inside tmux by pressing it TWICE.

Monday, July 20, 2015

Getting various R packages to work with Java 1.8 and rJava on OSX

If you attempt to install various R packages (e.g. RWeka) on OSX using a Java 1.8 runtime, you're likely to run into the following error message (even though you have a perfectly good installation of Java):
"No Java runtime present, requesting install.
ERROR: loading failed"

There are a ton of threads out there about this problem, but it seems to boil down to this unclosed (and untouched since 2014-01) JDK issue -> https://bugs.openjdk.java.net/browse/JDK-7131356

The "solution" can be found on the last comment on this rJava github issue: https://github.com/s-u/rJava/issues/37

  1. install JDK 1.6 from Apple (http://support.apple.com/kb/DL1572)
  2. open a new terminal window and make sure you're still using 1.8 - "java -version"
  3. run "sudo R CMD javareconf -n" from a terminal window
  4. start up R and install rJava again from source - install.packages("rJava", type="source")

Thursday, April 16, 2015

Trouble installing jpeg R package on OSX?

I'm taking the Coursera "Getting and Cleaning Data" class in R and one of the quizzes requires you to use the jpeg package. The R package install was failing for some reason though:
install.packages("jpeg")
In file included from read.c:1:
./rjcommon.h:11:10: fatal error: 'jpeglib.h' file not found
#include 
         ^
I use homebrew, so I tried the usual...
brew install jpeg
Warning: jpeg-8d already installed

brew unlink jpeg && brew link jpeg
But that didn't fix the issue. The solution was to install the XCode command line tools with:
xcode-select --install
(As a side note, this is my development machine so I already had XCode command line tools but for whatever reason I had to install them again, maybe an XCode upgrade?)

Sunday, July 24, 2011

Burn a VIDEO_TS folder to DVD

Suppose you have a VIDEO_TS folder lying around and you want to create a DVD that will actually play outside of your computer...

It's pretty easy to do, tough to remember - just run this command from a terminal window:

hdiutil makehybrid -udf-volume-name <title> -o ~/Desktop/<dvd_name>.iso <location_of_video_ts_folder>


Replace:

'title' with what you want the title of the DVD to be (e.g. 'awesome_summer')
'dvd_name' with the image file name you want (e.g. 'awesome_summer')
'location_of_video_ts_folder' with where your VIDEO_TS folder resides (e.g. ~/Desktop/MyReallyAwesomeSummer)

That will create the iso file in whatever location you specified - in my example, I'd have a file called awesome_summer.iso sitting on my Desktop). Navigate to that file in finder.

Ctrl-click on the ISO and choose 'Open with...' then Disk Utility.

Click on the ISO name from the left-hand side of Disk Utility then click 'Burn'

Monday, March 29, 2010

Installing JDeveloper 11 on OSX

Guess what, JDeveloper doesn't install out of box on a Mac... here's how to fix the JDK issue so you can at least get JDeveloper installed:

cd /System/Library/Frameworks/JavaVM.framework/Home
sudo mkdir -p jre/lib
cd jre/lib/
sudo ln -s ../../../Classes/classes.jar rt.jar

Friday, October 16, 2009

Die MacRoman, DIE!!

OSX defaults to MacRoman for an encoding, so if you're using Maven, you might see messages like:
[WARNING] Using platform encoding (MacRoman actually) to copy
filtered resources, i.e. build is platform dependent
Simple enough, but it can cause you headaches. To change to UTF-8, just add the following properties to your pom.xml:
<properties>
...
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
...
</properties>


(edit: had a couple typos, encoding in the property name needs to start with a capital E - camelCase)