npm global path prefix

Extending your PATH with: export PATH=/usr/local/share/npm/bin:$PATH isn’t a terrible idea. Having said that, you shouldn’t have to do it. Run this: npm config get prefix The default on OS X is /usr/local, which means that npm will symlink binaries into /usr/local/bin, which should already be on your PATH (especially if you’re using Homebrew). So: npm … Read more

How to fix homebrew permissions?

I was able to solve the problem by using chown on the folder: sudo chown -R “$USER”:admin /usr/local Also you’ll (most probably) have to do the same on /Library/Caches/Homebrew: sudo chown -R “$USER”:admin /Library/Caches/Homebrew Apparently I had used sudo before in a way that altered my folder permission on /usr/local, from here on forward all … Read more

How to convert an NSData into an NSString Hex string?

Keep in mind that any String(format: …) solution will be terribly slow (for large data) NSData *data = …; NSUInteger capacity = data.length * 2; NSMutableString *sbuf = [NSMutableString stringWithCapacity:capacity]; const unsigned char *buf = data.bytes; NSInteger i; for (i=0; i<data.length; ++i) { [sbuf appendFormat:@”%02X”, (NSUInteger)buf[i]]; } If you need something more performant try this: … Read more