Показаны сообщения с ярлыком Mac OS X. Показать все сообщения
Показаны сообщения с ярлыком Mac OS X. Показать все сообщения

суббота, 29 марта 2014 г.

Automatical prompting admin privileges launching an application on Mac os

If your application requires admin privileges and you don't want the user run it from command line with sudo then you can use Apple script to achieve it
First create an apple dropplet with the code below
on run
on run
 set appAlias to POSIX path of (path to resource "CamelAudioInstaller.app")
 set cmnd to appAlias & "Contents/MacOS/CamelAudioInstaller"
 
 #display dialog "You're going to launch the app without parameters" & cmnd buttons {"Ok"}
 do shell script cmnd with administrator privileges
end run
on open this_item
 set csPath to POSIX path of this_item
 set appAlias to POSIX path of (path to resource "CamelAudioInstaller.app")
 set cmnd to appAlias & "Contents/MacOS/CamelAudioInstaller " & csPath
 
 #display dialog "You're going to launch " & cmnd buttons {"Ok"}
 do shell script cmnd with administrator privileges
end open

Now after you double click the droplet you'll get the next


четверг, 17 октября 2013 г.

Getting current user's desktop path on Mac OS

The simplest solution is
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES );
NSString* theDesktopPath = [paths objectAtIndex:0];

But in the case of running the application in sudo mode it gives us the root's desktop path. To fix it use
 NSString* home = [[[NSProcessInfo processInfo] environment] objectForKey:@"HOME"];
 NSString *pathToDesktop = [NSString stringWithFormat:@"%@/Desktop", home];

суббота, 24 августа 2013 г.

How to build 32-bit curl and openssl on 64-bit Mac OS X

First let's donwload and build openssl:
OPENSSL_VERSION="1.0.1e"
mkdir -p ~/packages/tmp_src
cd ~/packages/tmp_src
curl http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz > openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386

cd openssl_i386
./Configure darwin-i386-cc
make -j 8
make install
cd ../
To make sure that we built 32-bit versions:
lipo -info /path/to/libssl.a
lipo -info /path/to/libcrypto.a
It should tell us that architecture is i386 Then do the same for curl
CURL_VERSION="7.29.0"
curl http://curl.haxx.se/download/curl-$CURL_VERSION.tar.gz > curl-$CURL_VERSION.tar.gz
tar xzvf curl-$CURL_VERSION.tar.gz
mv curl-$CURL_VERSION curl_i386
cd curl_i386
./configure --with-ssl=/usr/local/ssl --prefix=/Users/USERNAME/packages/tmp_src/curl_i386 --disable-shared --host=i386 --disable-ldap --without-zlib
make -j 8
#make install

воскресенье, 18 ноября 2012 г.

How to install Homebrew on Mac OS

Homebrew is the missing package manager for OS X

To install it type:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"