OSX – Jay R. Wren – lazy dawg evarlast http://jrwren.wrenfam.com/blog babblings of a computer loving fool Wed, 15 Feb 2017 02:57:57 +0000 en-US hourly 1 https://wordpress.org/?v=4.7.2 cross compiling go and go install v. go build and caching the results http://jrwren.wrenfam.com/blog/2017/01/26/cross-compiling-go-and-go-install-v-go-build-and-caching-the-results/ http://jrwren.wrenfam.com/blog/2017/01/26/cross-compiling-go-and-go-install-v-go-build-and-caching-the-results/#respond Thu, 26 Jan 2017 19:30:50 +0000 http://jrwren.wrenfam.com/blog/?p=1277 Continue reading "cross compiling go and go install v. go build and caching the results"]]> I am following Dave Chaney’s advice from here https://dave.cheney.net/2015/08/22/cross-compilation-with-go-1-5

I am on OSX using go installed from homebrew, so the writability of GOROOT in /usr/local/Cellar… is not an issue as stated in Dave’s post.

How can I reap the benefit of cached package builds when cross compiling?

`go install` uses the cache and places the resulting binary in $GOPATH/bin/$GOOS_$GOARCH/ instead of in $GOPATH/bin/

Of course, now that I’m writing this as a blog post, for myself, I see this is already mostly documented in the link from Dave’s post to medium: https://medium.com/@rakyll/go-1-5-cross-compilation-488092ba44ec#.6ue7ljf7v including a nice command to cross compile the std library in the system cache.

You can populate the stdlib cross compile pkg cache in GOROOT by running this command, changing env vars for each platform you wish to target:

GOOS=darwin GOARCH=amd64 sudo -E go install std

Now your cross compiles do not have to recompile the standard library packages.

]]>
http://jrwren.wrenfam.com/blog/2017/01/26/cross-compiling-go-and-go-install-v-go-build-and-caching-the-results/feed/ 0
Testing Out Apache All By Yourself http://jrwren.wrenfam.com/blog/2014/11/20/testing-out-apache-all-by-yourself/ Thu, 20 Nov 2014 23:19:14 +0000 http://jrwren.wrenfam.com/blog/?p=1148 Continue reading "Testing Out Apache All By Yourself"]]> By all by yourself, I mean, without root.

This is on my Mac running OSX 10.10.

  1. Get yourself an httpd.conf – cp /private/etc/apache2/httpd.conf .
  2. Edit it to use a port >1024 and with user you – Listen 8081 & User jrwren & Group staff
  3. Log to a place you can write – ErrorLog /home/jrwren/errorlog & CustomLog /home/jrwren/access_log combined
  4. Use different pidfile –  PidFile /home/jrwren/httpd.pid Do this fter the Include /private/etc/apache2/extra/httpd-mpm.conf
  5. Accept mutex –  Mutex file:/home/jrwren
  6. Edit whatever else you want – ProxyPass / http://localhost:8080 & SetOutputFilter DEFLATE to see that Apache proxy does gzip for you
  7. Start httpd – httpd -d . -f httpd.conf -X
]]>
Setup a New Mac http://jrwren.wrenfam.com/blog/2014/06/27/setup-a-new-mac/ Fri, 27 Jun 2014 14:30:55 +0000 http://jrwren.wrenfam.com/blog/?p=1120 Continue reading "Setup a New Mac"]]> A couple years later, and I find myself referring to my own guide

But in a different order of important things.

0. Caps Lock key is a Control key, Preferences->Keyboard, fix that, while I’m there, remove some of the -F keys from being bound, I’m going to need apps to see them.
1. I NEED THE SSH KEY, and copying a private key can be kind of a challenge, cuz… privacy.
2. Finder needs to see hidden files. http://lifehacker.com/188892/show-hidden-files-in-finder says – defaults write com.apple.finder AppleShowAllFiles TRUE ; killall Finder
3. AppStore has a nice purchases view, so I can easily find apps I have on the old/other Mac – click yes to Evernote.
4. Get iTerm2 – http://www.iterm2.com/#/section/home and DO NOT CLICK the big DOWNLOAD button… click the download tab/section at the top and get the Test Releases download, start it, and under profiles->default-> select the keys tab & click the Left option as +Esc selection
5. Copy .bashrc and .bash_profile
6. Copy Music/iTunes folder, maybe?
7. Manually inspect https://raw.githubusercontent.com/Homebrew/homebrew/go/install before actually going there and doing the http://brew.sh installation via ruby -switches $()… because… SECURITY!… also, I like to sudo mkdir /usr/local ; sudo chown $USER /usr/local ; so that home-brew install doesn’t run anything as root.
8.  System Preferences -> Keyboard -> Shortcuts -> All Controls (at the bottom) – so that I can tab to selections in dialog boxes
9.  MacVIM – because I like it
10.  vim things like python-mode, vim-fugitive
11.  firefox aurora and login with my firefox password
12.  brew install go
13.  add GOROOT to .bashrc and GOROOT/misc/vim to vim rtp
14.  … I don’t really know what else.

UGH, how could I forget: download Envy Code R and tell vim to use it: http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released  Add set guifont=Envy\ Code\ R:h13 to .vimrc

Follow the rest of the old post http://jrwren.wrenfam.com/blog/2012/03/07/setting-up-a-new-mac/

]]>
Installing iWork09 from CD without a Mac http://jrwren.wrenfam.com/blog/2012/04/21/installing-iwork09-from-cd-without-a-mac/ Sat, 21 Apr 2012 17:02:50 +0000 http://jrwren.wrenfam.com/blog/?p=1062 Continue reading "Installing iWork09 from CD without a Mac"]]> You’d think you could just use Apple’s nice CD Sharing program, aka Remote Disc http://support.apple.com/kb/HT1777?viewlocale=en_US

But sadly, the iWork09 CD is not an iso9660 disc. Instead it has an Apple style partition table, which was not readable by fdisk and crashed parted in linux, with an HFS+ filesystem. When you insert the disc into a Windows PC it simply will not read it.

So, I booted to Linux, used dd to rip the cd and started analyzing the contents of the disc. What I came up with was a way to extract the HFS+ filesystem from the disc image. Since I don’t really care about the filesystem being perfect – I only care about being able to install iWork on a new Mac Book Air – I only care about where it starts and I run a fsck tool to repair the end of filesystem.

The filesystem begins at an offset of 72blocks (36864bytes):
$ if=iwork09.img bs=512 skip=72 of=iwork09-1.img

Repair the filesystem:
$ fsck.hfsplus iwork09-1.img

Mount it and copy the iWork directory or install it from there
$ mount -t hfsplus iwork09-1.img /mnt

A little extra work, but it beats a trip to the Genius Bar.

 

]]>
OSX /private/var/vm disk usage http://jrwren.wrenfam.com/blog/2011/12/16/osx-privatevarvm-disk-usage/ http://jrwren.wrenfam.com/blog/2011/12/16/osx-privatevarvm-disk-usage/#comments Fri, 16 Dec 2011 13:41:57 +0000 http://jrwren.wrenfam.com/blog/?p=1032 Continue reading "OSX /private/var/vm disk usage"]]> TL;DR see last paragraph.

I googled around for this answer and found nothing, so THEN I read the man page. This felt backward for OSX answers.
My Mac gave me warning that I was almost out of disk space recently. I ran du -kx / | sort -nr | less and noticed the biggest offender with nearly 10% of my disk space was /var/private/vm, so I started digging.
It turns out this is where OSX stores its swap files if it needs them.
OSX dynamically grows its swap files by adding new files, not by resizing an existing file. It starts off with very small files and as it needs a new one it creates a large one until it gets to 1GB file size and then it continues making 1GB swap files. The process dynamic_pager manages this.
In my case the 5GB of swap didn’t seem like that much until you consider that I have a 64GB MacBook Air. That is a large piece of the disk.
I told the dynamic_pager to clean up after itself, if it could, by running this command:

sudo dynamic_pager -L 1073741824

]]>
http://jrwren.wrenfam.com/blog/2011/12/16/osx-privatevarvm-disk-usage/feed/ 3