         else
           fs.chmod(destinationPath, 0o755, callback)
 
+symlinkCommandWithPrivilegeSync = (sourcePath, destinationPath) ->
+  runas('/bin/mkdir', ['-p', path.dirname(destinationPath)], admin: true)
+  runas('/bin/ln', ['-s', sourcePath, destinationPath], admin: true) is 0
+
 unlinkCommand = (destinationPath, callback) ->
   fs.unlink destinationPath, (error) ->
     if error? and error.code isnt 'ENOENT'
       callback(error)
     else
       callback()
+
+unlinkCommandWithPrivilegeSync = (destinationPath) ->
+  runas('/bin/rm', ['-f', destinationPath], admin: true) is 0
 
 module.exports =
   getInstallDirectory: ->

    if fs.existsSync(directory)
      destinationPath = path.join(directory, commandName)
      unlinkCommand destinationPath, (error) =>
        if error?
          error = new Error "Could not remove file at #{destinationPath}." if error
          callback?(error)
        else
          symlinkCommand commandPath, destinationPath, (error) =>
            error = new Error "Failed to symlink #{commandPath} to #{destinationPath}." if error
            callback?(error)
    else

async = require 'async'
fs = require 'fs-plus'
mkdirp = require 'mkdirp'
runas = require 'runas'

symlinkCommand = (sourcePath, destinationPath, callback) ->
  mkdirp path.dirname(destinationPath), (error) ->
