michaelfox + mac   305

Configure DNS lookups from the terminal - Mac OS X Hints
There's a lot of conflicting information about how to set networking information (such as DNS resolution configuration) from the terminal. In the course of setting up a VPN package (openvpn) on OS X, I had to set the DNS resolution configuration dynamically from a shell script.

As of (at least) 10.3, /etc/resolv.conf (or /var/run/resolv.conf) is NOT the place to do this. Re-writing /etc/resolv.conf resulted in a system where a DNS lookup with host would work, but dig and ping would not. Sometimes /etc/resolv.conf would be magically restored to its original configuration. I thought the smarter option would be in the NetInfo database, except on my machine, I had no resolver configuration hiding there.
,br> The answer? OS X has a daemon called configd, which magically collects configuration information, sends notifications, and maintains a dynamic database of the current settings. The host command would read my hacked-up /etc/resolv.conf, but smarter DNS lookups would query the network configuration database from configd.

The command-line tools to interface with the configuration daemon are scselect and scutil. scselect provides a list of defined network locations (as in the Network preference pane) and allows you to choose between them. scutil enables much more fine-grained control over the current network configuration. Unfortunately, it only really offers a command-line interface to modify the configuration database. To use scutil from a bash script, you must dynamically create an scutil script as a text file, and pipe it to scutil.

The following sample scutil sessions perform some useful tasks...

To retrieve the current primary network interface:
dns  mac  osx 
september 2011 by michaelfox
UTI Property List Helper
### Description

In Mac OS X 10.3, Apple introduced a new scheme for identifying data types called [Uniform Type Identifiers][1].

One requirement that Mac OS X puts on any application that wants to use these identifiers is that it declare them in its Info.plist—not just in [CFBundleDocumentTypes][2] and [NSServices][3], but also in [UTImportedTypeDeclarations][4] and [UTExpertedTypeDeclarations][5]. Otherwise, Mac OS X 10.4 and later will ignore your application's uses of those UTIs elsewhere in your Info.plist.

This creates a lot of work for you, especially when importing a type declaration. Exporting a new declaration is easy, because it's your type: you can make up whatever you want. But to import a declaration, you must gather information about it and construct the dictionary yourself. This gets tedious, especially for some types (such as image types) that you may import in one application after another.

UTI Property List Helper is an application to solve this problem for you.

![The UTI Property List Helper window contains a table view, wherein you enter the UTIs, and two text views: one showing the CFBundleDocumentTypes array, and the other showing the UTImportedTypeDeclarations array.][6]


Simply add types to the list in the upper half of the window, and UTI Property List Helper will automatically update the two arrays in the lower half. When you're done, either select and copy each array's XML text into your Info.plist, or save it to a file.

### Mercurial repository

If you want to contribute bug-fixes or enhancements to UTIPropertyListHelper, the easiest way to do that is to clone [the Mercurial repository for UTIPropertyListHelper][7]. To do this, type this command into a terminal:

hg clone http://boredzo.org/uti-plist-helper/hg UTI-Plist-Helper

I provide UTIPlistHelper—the application, and its source code—under a three-clause BSD license. For more information, see the file named LICENSE.txt that comes with it.

[1]: http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/
[2]: http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html#//apple_ref/doc/uid/20001431-101685
[3]: http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html#//apple_ref/doc/uid/20001431-107265
[4]: http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html#//apple_ref/doc/uid/20001431-114192
[5]: http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html#//apple_ref/doc/uid/20001431-SW7
[6]: http://boredzo.org/UTI_Plist_Helper.png
[7]: http://boredzo.org/hg
shell  scripting  bash  uti  plist  tools  osx  xml  mac 
september 2011 by michaelfox
BibDesk
Use BibDesk to edit and manage your bibliography. It will keep track of both the bibliographic information and the associated files or web links for you. BibDesk’s services will simplify using your bibliography in other applications and are particularly well suited for LATEX users.

BibDesk is developed as an open source project and available free of charge. Any contributions to further its development are appreciated.

Please visit the BibDesk Wiki or follow the links below for additional information.
bibliography  latex  mac  osx  software 
june 2011 by michaelfox
« earlier      

related tags

*todo  -  accessorizer  account  addressbook  adium  air  airplay  airport  amazon  analytics  animation  apache  api  app  apple  applescript  appletv  apps  apt  archive  art  asdictionary  astranslate  audio  automation  automator  background  backup  bandwidth  bank  bash  bestpractices  beta  bibliography  bind  bindings  blog  bookmarklets  boot  brew  browser  brushes  budget  build  bundle  buttons  c  calendar  caps  chapters  chat  chatlogs  cheatsheet  checkbook  chm  chrome  cli  click  clock  clone  cocoa  code  codec  coding  coffeescript  collection  color  colors  commandline  commands  compile  completion  composer  compress  compressed  compression  config  configuration  context  conversion  convert  converter  couchdb  cron  css  css3  csv  customization  dashboard  database  date  debug  debugging  decals  defaults  demo  deployment  design  desk  desktop  desktopmanager  dev  developer  development  dialog  disk  divx  django  dmg  dns  dnsmasq  documentation  dotfiles  dotmac  download  dupin  duplicates  dvd  DVR  ebooks  editing  editor  email  emulation  emulator  emulators  encode  encoding  encryption  environment  escape  events  example  examples  extension  ffmpeg  file  files  finance  finder  Finer  firefox  fluid  folderactions  forum  framework  free  frontrow  ftp  games  geek  geektool  gif  GIMP  gist  git  github  gmail  google  googlereader  gradients  graphics  growl  gtd  gui  gzip  hack  hacks  harddrive  hazel  HDTV  helloworld  hidden  homeautomation  homebrew  hometheater  hosts  hotkey  hotkeys  howto  htmac  html  html5  htpc  ical  icons  ide  ie  ie6  ifttt  ikey  image  imagemagick  images  in  indexing  input  inspiration  install  installation  interface  interfacebuilder  ios  ipad  iphone  ipod  ipython  isight  iterm  itunes  java  javascript  jpg  jquery  json  key  keybindings  keyboard  keyboardmaestro  keyboardshortcuts  lamp  laptop  latex  launchbar  launcher  less  lh  library  lifehacker  linux  lion  list  mac  mac.cron  macbook  macmini  macos  macosx  macros  magicwand  mail  maintenance  mamp  manager  markdown  markup  math  mathematics  mcrypt  mdfind  mdls  mdutil  media  mediacenter  memcache  memory  menu  metadata  mht  microsoft  mini  minify  mirror  mkv  mobile  mobileme  money  monitor  monitoring  mouse  movie  movies  mp3  mp4  mp4v2  multiple  music  musicbrainz  mux  muxer  mysql  network  networking  nightlies  nightly  node  notes  objc  objective-c  objectivec  office  omni  omnifocus  openmeta  opensource  optimization  optimize  organization  organizer  osx  output  pages  parser  parsing  password  path  pear  performance  photoshop  php  phpunit  player  playstation  plist  plugin  plugins  png  preferences  presentation  processes  productivity  profile  programming  projects  protocols  ps3  python  q  q.app  qemu  quartz  quartzcomposer  quicklook  quicksilver  quix  rails  reader  receipt  record  redis  reference  remap  remote  remux  resources  rhino  ringtone  rsync  ruby  rubycocoa  rubygems  rubyonrails  s3  safari  science  screen  screencast  screensaver  screensharing  screenshot  script  scripting  scripts  sdk  search  security  server  service  services  settings  setup  sharing  shell  shopping  shortcut  shortcuts  signature  sleep  smtp  snippet  snippets  snow  software  sound  source  sourcecode  space  sparrow  speed  spotlight  ssh  stickers  streaming  sublime  subtitles  support  symbols  sync  syncing  synergy  system  tag  tagging  tags  tags.app  tar  Tech  terminal  testing  tex  text  textmate  theme  themes  Things  thumbnail  time  timetracking  tips  toolbar  tools  torrents  track  tracking  transmit  tricks  troubleshooting  tutorial  tutorials  tv  tweak  tweals  typography  ui  uitableview  ultimatebuild  uninstall  unisom  unix  update  updates  url  userscripts  userstyles  uti  utilities  utility  utils  validation  versioncontrol  video  videolan  vim  virtual  virtualization  virus  visualization  vlc  vmware  vnc  vpn  wallpaper  webarchive  WebDav  webdesign  webdev  webkit  webview  widget  wifi  wiki  window  windows  wine  wishlist  xbox  xbox360  xcode  xdebug  xml  xvid  zen  zend  zend.server  zend.serverce  zip  zsh   

Copy this bookmark:



description:


tags: