<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ruby, Rails, OSX and Linux fun &#187; osx</title>
	<atom:link href="http://www.frederico-araujo.com/tag/osx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.frederico-araujo.com</link>
	<description>Ruby, Rails, OSX and linux sysadmin</description>
	<lastBuildDate>Thu, 02 Sep 2010 08:13:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Really checking the content-type/mime_type of a file in OSX and Linux</title>
		<link>http://www.frederico-araujo.com/2009/06/14/really-finding-the-content-type-of-a-file-in-osx-and-linux/</link>
		<comments>http://www.frederico-araujo.com/2009/06/14/really-finding-the-content-type-of-a-file-in-osx-and-linux/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 18:55:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[osx]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[content_type]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mime_type]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.frederico-araujo.com/?p=95</guid>
		<description><![CDATA[I have came across many projects where checking file uploads and content-type (mime-type) is poorly implemented or heavy in resource.
Methods I have seen so far:
1. Checking content-type from file name: this inefficient, a user can just rename a file and you are fooled, or the file can have a different file format and you will [...]]]></description>
			<content:encoded><![CDATA[<p>I have came across many projects where checking file uploads and content-type (mime-type) is poorly implemented or heavy in resource.</p>
<p>Methods I have seen so far:</p>
<p>1. Checking content-type from file name: this inefficient, a user can just rename a file and you are fooled, or the file can have a different file format and you will not get the expected result.</p>
<p>2. Using Rmagick to check if the file is an image. This is so slow and uses so much Ram. You can try to initialize an rmagick object from an image file, then rescue when the file is not an image.</p>
<p>3. Using mini_magick to check if a file. This method is faster than rmagick. Implemen ted same way as rmagick.</p>
<p>A Better method for OSX and Linux,  is to use the command line tool &#8220;file&#8221; included in most UNIX operating systems.</p>
<p>It is very fast and very accurate.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">file = <span style="color:#996600;">&quot;/path/to/file.ext&quot;</span>
<span style="color:#9966CC; font-weight:bold;">if</span> RUBY_PLATFORM.<span style="color:#9900CC;">match</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>darwin<span style="color:#006600; font-weight:bold;">|</span>linux<span style="color:#006600; font-weight:bold;">|</span>unix<span style="color:#006600; font-weight:bold;">|</span>solaris<span style="color:#006600; font-weight:bold;">|</span>bsd<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>
 content_type = <span style="color:#996600;">`file --raw --brief &quot;#{file}&quot;`</span>.<span style="color:#CC0066; font-weight:bold;">chomp</span>
 <span style="color:#9966CC; font-weight:bold;">case</span>
  <span style="color:#9966CC; font-weight:bold;">when</span> content_type.<span style="color:#9900CC;">match</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>image<span style="color:#006600; font-weight:bold;">|</span>png<span style="color:#006600; font-weight:bold;">|</span>jpg<span style="color:#006600; font-weight:bold;">|</span>jpeg<span style="color:#006600; font-weight:bold;">|</span>gif<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>
   real_type = <span style="color:#996600;">&quot;image&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">when</span> content_type.<span style="color:#9900CC;">match</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>pdf<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>
   real_type = <span style="color:#996600;">&quot;pdf&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">when</span> content_type.<span style="color:#9900CC;">match</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Microsoft Word|Microsoft Office Document&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
   real_type = <span style="color:#996600;">&quot;doc&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">else</span> <span style="color:#008000; font-style:italic;"># This can go on and on</span>
   real_type = <span style="color:#996600;">&quot;Unknown&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Some examples of content types:</p>
<p>.doc =  Microsoft Word document data</p>
<p>.doc = Microsoft Office Document</p>
<p>.pdf = PDF document, version 1.4</p>
<p>.pdf = PDF document, version 1.3</p>
<p>.psd = Adobe Photoshop Image</p>
<p>.png  = PNG image data, 3508 x 4961, 8-bit/color RGBA, non-interlaced</p>
<p>.gif = GIF image data, version 89a, 195 x 109</p>
<p>.jpg = JPEG image data, EXIF standard</p>
<p>etc&#8230;</p>
<p>I hope this can be useful to someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frederico-araujo.com/2009/06/14/really-finding-the-content-type-of-a-file-in-osx-and-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Easy installing Nginx + mod_rails passenger OSX</title>
		<link>http://www.frederico-araujo.com/2009/06/14/easy-installing-nginx-mod_rails-passenger-osx/</link>
		<comments>http://www.frederico-araujo.com/2009/06/14/easy-installing-nginx-mod_rails-passenger-osx/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 18:39:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[nginx]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[mod_rails]]></category>
		<category><![CDATA[passenger]]></category>

		<guid isPermaLink="false">http://www.frederico-araujo.com/?p=92</guid>
		<description><![CDATA[Requirements:
1. XCODE  you can download xcode from http://developer.apple.com/tools/xcode/index.html
2. OSX 10.4, 10.5 or 10.6
Procedures:
1. Install Passenger
$ sudo gem install passenger
now check where is passenger installed:

$ passenger-config --root

in my case is: /opt/local/lib/ruby/gems/1.8/gems/passenger-2.2.5
2. Install nginx
If you have nginx from macports, deactivate it in case of conflicts.
You can activate anytime later
$ sudo port deactivate nginx
$ wget http://sysoev.ru/nginx/nginx-0.7.59.tar.gz
$ wget [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Requirements</strong>:</p>
<p>1. XCODE  you can download xcode from <a href="http://developer.apple.com/tools/xcode/index.html">http://developer.apple.com/tools/xcode/index.html</a></p>
<p>2. OSX 10.4, 10.5 or 10.6</p>
<p><strong>Procedures</strong>:</p>
<p><strong>1. Install Passenger</strong></p>
<p>$ sudo gem install passenger</p>
<p>now check where is passenger installed:</p>
<pre>
$ passenger-config --root
</pre>
<p>in my case is: /opt/local/lib/ruby/gems/1.8/gems/passenger-2.2.5</p>
<p><strong>2. Install nginx</strong></p>
<p>If you have nginx from macports, deactivate it in case of conflicts.</p>
<p>You can activate anytime later</p>
<p>$ sudo port deactivate nginx</p>
<p><del datetime="2009-06-16T13:04:06+00:00">$ wget http://sysoev.ru/nginx/nginx-0.7.59.tar.gz</p>
<p>$ wget http://sysoev.ru/nginx/nginx-0.7.62.tar.gz</p>
<p>$ tar xpf nginx-0.7.62.tar.gz</p>
<p>$ cd nginx-0.7.62</p>
<p></del></p>
<p><del datetime="2009-09-23T22:31:19+00:00">
<p>I Recommend using nginx 0.6 series because I had a lot of  &#8220;502 Bad Gateway&#8221; with 0.7 series. </p>
<p>$ wget http://sysoev.ru/nginx/nginx-0.6.37.tar.gz</p>
<p>$ tar xpf nginx-0.6.37.tar.gz</p>
<p>$ cd nginx-0.6.37<br />
</del></p>
<pre>
$ sudo ./configure --add-module=/opt/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/nginx/ \
  --with-http_ssl_module --user=nobody --group=nobody --with-http_gzip_static_module \
  --with-poll_module --prefix=/opt/local --with-pcre
</pre>
<pre>
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1 library is not used
+ using system zlib library

nginx path prefix: "/opt/local"
nginx binary file: "/opt/local/sbin/nginx"
nginx configuration prefix: "/opt/local/conf"
nginx configuration file: "/opt/local/conf/nginx.conf"
nginx pid file: "/opt/local/logs/nginx.pid"
nginx error log file: "/opt/local/logs/error.log"
nginx http access log file: "/opt/local/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
</pre>
<p>$ sudo make</p>
<p>$ sudo make install</p>
<p>$ cd /opt/local/conf</p>
<p>$ sudo cp mime.types.default mime.types</p>
<p>$ sudo cp nginx.conf.default nginx.conf</p>
<p><strong>Edit nginx.conf</strong></p>
<p>$ mate nginx.conf</p>
<p>or</p>
<p>$ sudo vi nginx.conf</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;">&nbsp;
<span style="color: #00007f;">user</span> nobody;
worker_processes  <span style="color: #ff0000;">2</span>;
&nbsp;
<span style="color: #adadad; font-style: italic;">#error_log  logs/error.log;</span>
<span style="color: #adadad; font-style: italic;">#error_log  logs/error.log  notice;</span>
error_log  logs/error.log  info;
&nbsp;
<span style="color: #adadad; font-style: italic;"># Pid</span>
pid  logs/nginx.pid;
&nbsp;
events {
worker_connections <span style="color: #ff0000;">1024</span>;
}
&nbsp;
http {
<span style="color: #00007f;">include</span>       mime.types;
default_type  application/octet-stream;
&nbsp;
sendfile        <span style="color: #0000ff;">on</span>;
<span style="color: #adadad; font-style: italic;">#tcp_nopush     on;</span>
&nbsp;
<span style="color: #adadad; font-style: italic;">#keepalive_timeout  0;</span>
keepalive_timeout  <span style="color: #ff0000;">65</span>;
&nbsp;
gzip  <span style="color: #0000ff;">on</span>;
<span style="color: #adadad; font-style: italic;"># if a precompiled gzip of the file exists, use it and force http proxies</span>
<span style="color: #adadad; font-style: italic;"># to use separate cache's based on User-Agent</span>
gzip_static <span style="color: #0000ff;">on</span>;
gzip_min_length <span style="color: #ff0000;">2000</span>;
gzip_buffers    <span style="color: #ff0000;">16</span> 8k;
gzip_types      text/plain text/html text/css image/x-icon application/xml application/xml+rss text/javascript;
gzip_disable    <span style="color: #7f007f;">&quot;MSIE [1-6] <span style="color: #000099; font-weight: bold;">\.</span>&quot;</span>;
gzip_vary         <span style="color: #0000ff;">on</span>;
gzip_comp_level   <span style="color: #ff0000;">2</span>;
&nbsp;
gzip_proxied any;
&nbsp;
server {
<span style="color: #00007f;">listen</span>       <span style="color: #ff0000;">80</span>;
server_name  localhost;
<span style="color: #00007f;">location</span> / {
root   /Users/fred/Sites ;
autoindex <span style="color: #0000ff;">on</span>;
index  index.html index.htm;
}
}
&nbsp;
passenger_root /opt/local/lib/ruby/gems/<span style="color: #ff0000;">1.8</span>/gems/passenger-2.2.2;
passenger_max_pool_size <span style="color: #ff0000;">8</span>;
passenger_max_instances_per_app <span style="color: #ff0000;">1</span>;
<span style="color: #adadad; font-style: italic;"># The maximum number of seconds that an application instance may be idle.</span>
<span style="color: #adadad; font-style: italic;"># That is, if an application instance hasn’t received any traffic after the given number of seconds,</span>
<span style="color: #adadad; font-style: italic;"># then it will be shutdown in order to conserve memory.</span>
passenger_pool_idle_time <span style="color: #ff0000;">3600</span>;
&nbsp;
<span style="color: #adadad; font-style: italic;"># Project 1</span>
server {
<span style="color: #00007f;">listen</span> <span style="color: #ff0000;">80</span>;
client_max_body_size 250M;
server_name project1.local;
root /Users/fred/rails/project1/public;
passenger_enabled <span style="color: #0000ff;">on</span>;
rails_env development;
access_log  /Users/fred/rails/project1/log/nginx.access.log;
error_log  /Users/fred/rails/project1/log/nginx.error.log info;
}
&nbsp;
<span style="color: #adadad; font-style: italic;"># Project 2</span>
server {
<span style="color: #00007f;">listen</span> <span style="color: #ff0000;">80</span>;
client_max_body_size 250M;
server_name project2.local;
root /Users/fred/rails/project2/public;
passenger_enabled <span style="color: #0000ff;">on</span>;
rails_env development;
access_log  /Users/fred/rails/project2/log/nginx.access.log;
error_log  /Users/fred/rails/project2/log/nginx.error.log info;
}
&nbsp;
<span style="color: #adadad; font-style: italic;"># Project 3</span>
server {
<span style="color: #00007f;">listen</span> <span style="color: #ff0000;">80</span>;
client_max_body_size 250M;
server_name project3.local;
root /Users/fred/rails/project3/public;
passenger_enabled <span style="color: #0000ff;">on</span>;
rails_env development;
access_log  /Users/fred/rails/project3/log/nginx.access.log;
error_log  /Users/fred/rails/project3/log/nginx.error.log info;
}
&nbsp;
<span style="color: #adadad; font-style: italic;"># And so on... as many projects as you want</span>
&nbsp;
}</pre></td></tr></table></div>

<p>Now edit your /etc/hosts and add the hosts for your local project</p>
<p>$ mate /etc/hosts</p>
<pre>

127.0.0.1   project1.local

127.0.0.1   project2.local

127.0.0.1   project3.local
</pre>
<p><strong>3. Start nginx</strong></p>
<p>sudo nginx</p>
<p><strong>4. go to your browser and open project1.local</strong></p>
<p><strong> <img src='http://www.frederico-araujo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p>
<p><strong>5. Easy start/restart/stop</strong></p>
<p>add this to your ~/.bash_profile file</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> nginx_reload<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #007800;">FILE</span>=<span style="color: #ff0000;">&quot;/opt/local/logs/nginx.pid&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$FILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Reloading NGINX...&quot;</span>
<span style="color: #007800;">PID</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>logs<span style="color: #000000; font-weight: bold;">/</span>nginx.pid<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-HUP</span> <span style="color: #007800;">$PID</span>
<span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Nginx pid file not found&quot;</span>
<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> nginx_stop<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #007800;">FILE</span>=<span style="color: #ff0000;">&quot;/opt/local/logs/nginx.pid&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$FILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Stopping NGINX...&quot;</span>
<span style="color: #007800;">PID</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>logs<span style="color: #000000; font-weight: bold;">/</span>nginx.pid<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-INT</span> <span style="color: #007800;">$PID</span>
<span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Nginx pid file not found&quot;</span>
<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> nginx_restart<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #007800;">FILE</span>=<span style="color: #ff0000;">&quot;/opt/local/logs/nginx.pid&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$FILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Stopping NGINX...&quot;</span>
<span style="color: #007800;">PID</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>logs<span style="color: #000000; font-weight: bold;">/</span>nginx.pid<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-INT</span> <span style="color: #007800;">$PID</span>
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting NGINX...&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> nginx
<span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Nginx pid file not found&quot;</span>
<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></td></tr></table></div>

<p><strong>Troubleshooting</strong></p>
<p>1. Nginx is not running</p>
<p>- check the logs</p>
<p>- check if it is really not running:</p>
<p>$ ps aux | grep nginx</p>
<p>2. you see the nginx error &#8220;502 Bad Gateway&#8221;</p>
<p>- may there is a problem with the /var/folders/ permissions on OSX:</p>
<pre>

2009/06/13 16:14:33 [crit] 1106#0: *1 connect() to unix:/var/folders/xl/xlSRYvzFHH8Fcehc51ciyE+++TI/-Tmp-//passenger.1091/master/helper_server.sock failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: hassan.local, request: "GET / HTTP/1.1", upstream: "unix:/var/folders/xl/xlSRYvzFHH8Fcehc51ciyE+++TI/-Tmp-//passenger.1091/master/helper_server.sock:", host: "hassan.local"
</pre>
<p>to fix it I did this:</p>
<p>$ sudo find /var/folders/xl/ -name &#8220;master&#8221; -exec chmod 755 {} \;</p>
<p>$ sudo find /var/folders/xl/ -name &#8220;-Tmp-&#8221; -exec chmod 755 {} \;</p>
<p>everytime I reboot my mac I had to do that&#8230; I still dont know how to fix it&#8230;</p>
<p>anybody knows?</p>
<p>That is it for now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frederico-araujo.com/2009/06/14/easy-installing-nginx-mod_rails-passenger-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blazing Fast Firefox using OSX RamDisk</title>
		<link>http://www.frederico-araujo.com/2008/12/18/blazing-fast-firefox-using-osx-ramdisk/</link>
		<comments>http://www.frederico-araujo.com/2008/12/18/blazing-fast-firefox-using-osx-ramdisk/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 09:32:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[osx]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[ramdisk]]></category>
		<category><![CDATA[tmpfs]]></category>

		<guid isPermaLink="false">http://www.frederico-araujo.com/?p=55</guid>
		<description><![CDATA[Firefox does a lot of IO to the disk even thou you have lots of spare Ram, due to Sqlite, Bookmarks, History and Cache.
To make Firefox faster is to store the whole profile folder into a Ram Disk.
RamDisk in Linux are called TmpFS. You can also use shared memory folder /dev/shm if you have it [...]]]></description>
			<content:encoded><![CDATA[<p>Firefox does a lot of IO to the disk even thou you have lots of spare Ram, due to Sqlite, Bookmarks, History and Cache.</p>
<p>To make Firefox faster is to store the whole profile folder into a Ram Disk.<br />
RamDisk in Linux are called TmpFS. You can also use shared memory folder /dev/shm if you have it in your fstab.</p>
<p>This <a href="http://forums.gentoo.org/viewtopic.php?p=5319242"> post </a> in the gentoo forums explains how to do it in Gentoo linux.</p>
<p>I made a similar script to make it work in OSX Leopard.</p>
<p>The Script have 2 parts, Start.sh and Stop.sh<br />
Here are the Scripts:</p>
<p>Start.sh</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Run this script to enable the Ramdisk for Firefox profiles</span>
<span style="color: #007800;">VolumeName</span>=<span style="color: #ff0000;">&quot;Mozilla&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Size in MB, make sure is not too low or not too high</span>
<span style="color: #007800;">SizeInMB</span>=<span style="color: #000000;">220</span>
&nbsp;
<span style="color: #007800;">NumSectors</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">1024</span><span style="color: #000000; font-weight: bold;">*</span>SizeInMB<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #007800;">DeviceName</span>=<span style="color: #000000; font-weight: bold;">`</span>hdid <span style="color: #660033;">-nomount</span> ram:<span style="color: #000000; font-weight: bold;">//</span><span style="color: #007800;">$NumSectors</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$DeviceName</span>
&nbsp;
diskutil eraseVolume HFS+ RAMDisk <span style="color: #007800;">$DeviceName</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># move the current profiles folder</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> Profiles Profiles_ <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;
&nbsp;
<span style="color: #666666; font-style: italic;"># make a symlink to the ramdisk</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>Volumes<span style="color: #000000; font-weight: bold;">/</span>RAMDisk .<span style="color: #000000; font-weight: bold;">/</span>Profiles <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;
&nbsp;
<span style="color: #666666; font-style: italic;"># then copy it to the ramdisk</span>
<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-r</span> Profiles_<span style="color: #000000; font-weight: bold;">/*</span> Profiles</pre></div></div>

<p>Stop.sh</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Cache<span style="color: #000000; font-weight: bold;">/</span>Firefox<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># clean the cache</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span>  Profiles<span style="color: #000000; font-weight: bold;">/*/</span>Cache<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;
&nbsp;
<span style="color: #666666; font-style: italic;"># will save your modifications back to the DISK</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>rsync <span style="color: #660033;">-av</span> <span style="color: #660033;">--delete</span> .<span style="color: #000000; font-weight: bold;">/</span>Profiles<span style="color: #000000; font-weight: bold;">/</span> .<span style="color: #000000; font-weight: bold;">/</span>Profiles_<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;
&nbsp;
<span style="color: #666666; font-style: italic;"># sometimes during unmount it will say disk is in use.</span>
<span style="color: #666666; font-style: italic;"># make sure you close firefox before.</span>
<span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>Volumes<span style="color: #000000; font-weight: bold;">/</span>RAMDisk <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> Profiles <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;
<span style="color: #c20cb9; font-weight: bold;">mv</span> Profiles_ Profiles</pre></div></div>

<p>You can also use &#8216;tar&#8217; instead of &#8216;rsync&#8217;. I just love rsync more.</p>
<p>* Warning: The ramdisk contents will be erased after you umount the ramdisk.</p>
<p>Have fun.</p>
<p><strong><a href="http://www.gentoo.org">Gentoo Linux ROCKS</a></strong></p>
<p>Update:</p>
<p>To speed up firefox even more  run these commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Caches<span style="color: #000000; font-weight: bold;">/</span>Firefox<span style="color: #000000; font-weight: bold;">/</span>Profiles
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*/*</span>.sqlite; <span style="color: #000000; font-weight: bold;">do</span> sqlite3 <span style="color: #007800;">$i</span> VACUUM;<span style="color: #000000; font-weight: bold;">done</span>;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Application\ Support<span style="color: #000000; font-weight: bold;">/</span>Firefox<span style="color: #000000; font-weight: bold;">/</span>Profiles
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*/*</span>.sqlite; <span style="color: #000000; font-weight: bold;">do</span> sqlite3 <span style="color: #007800;">$i</span> VACUUM;<span style="color: #000000; font-weight: bold;">done</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.frederico-araujo.com/2008/12/18/blazing-fast-firefox-using-osx-ramdisk/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Getting Filevault on a HFS+ Case-Sensitive Filesystem</title>
		<link>http://www.frederico-araujo.com/2008/11/04/getting-filevault-on-a-hfs-case-sensitive-filesystem/</link>
		<comments>http://www.frederico-araujo.com/2008/11/04/getting-filevault-on-a-hfs-case-sensitive-filesystem/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 13:55:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[osx]]></category>
		<category><![CDATA[filevault]]></category>

		<guid isPermaLink="false">http://www.frederico-araujo.com/?p=45</guid>
		<description><![CDATA[The OSX file vault feature will only let you activate it on your current home folder if you have a HFS+ case-insensitive file system. It will not let you activate it on a current HFS case-sensitive.
But there is a trick, when creating a &#8220;new&#8221; clean user it will allow you to enable filevault for that [...]]]></description>
			<content:encoded><![CDATA[<p>The OSX file vault feature will only let you activate it on your current home folder if you have a HFS+ case-insensitive file system. It will not let you activate it on a current HFS case-sensitive.</p>
<p>But there is a trick, when creating a &#8220;new&#8221; clean user it will allow you to enable filevault for that new user.</p>
<p>So, here is how you do it.</p>
<p>But before you try, make sure you have enough free space, try to get rid of huge files and folders, backup your data. (in this case, we will copy your data, so you will have 2 copies for safety)</p>
<p>Also clean your applications cache, such as firefox cache, camino, opera,<br />
~/Library/caches/com.apple.Safari/Webpage\ Previews/ , etc&#8230;: and close most of your applications.</p>
<p>$ cd ~/Library/Caches</p>
<p>$ find ./ -name &#8220;Cache&#8221; -exec rm -rf {} \;</p>
<p>$ rm -rf ~/Library/Caches/com.apple.Safari/Webpage\ Previews/Incoming/*</p>
<p>Steps</p>
<p>1. Create another admin user, for example &#8220;admin&#8221;, with administrator privileges</p>
<p>2. login as that user.</p>
<p>3. move your old user folder.</p>
<p>$ cd /Users/</p>
<p>$ sudo mv myusername myusername.bak</p>
<p>3. delete your old user from the &#8220;Accounts&#8221; preferences pane.</p>
<p>4. then create it again and check the option to use filevault</p>
<p>5. Logout from &#8220;admin&#8221;  and login again as newuser.</p>
<p>6. Now copy the old data to your home folder. ( will take a very long time for that)<br />
update: You must use rsync instead of cp, so that you also copy your VERY important hidden files. such as .ssh .gnupg .vimrc .gem .gitconfig  etc..</p>
<p>$ sudo /usr/bin/rsync -av /Users/myusername.bak/ /Users/myusername/</p>
<p># watch out if you have files that should not change the ownership, such as server backups.<br />
$ sudo chown -R  myusername ~/</p>
<p>7. Logout and login again, for your preferences to take effect</p>
<p>8. If everything looks fine, you might just delete the backup folder.</p>
<p>$ sudo rm -rf /Users/myusername.bak</p>
<p>if you have any confusions let me know in comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frederico-araujo.com/2008/11/04/getting-filevault-on-a-hfs-case-sensitive-filesystem/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>FastSleep or Hibernate on OSX Leopard? ;)</title>
		<link>http://www.frederico-araujo.com/2008/11/01/safesleep-fastsleep-or-hibernate-osx-leopard/</link>
		<comments>http://www.frederico-araujo.com/2008/11/01/safesleep-fastsleep-or-hibernate-osx-leopard/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 20:40:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://wp.frederico-araujo.com/?p=22</guid>
		<description><![CDATA[First of all, what do I mean by safe sleep, fast sleep or hibernate?
Safe sleep is the way OSX sleeps to RAM and as well create a sleepimage (which is the size of your RAM). In case you run out of battery, so you can still resume from the image if the battery is dead, [...]]]></description>
			<content:encoded><![CDATA[<p>First of all, what do I mean by safe sleep, fast sleep or hibernate?</p>
<p><strong>Safe sleep</strong> is the way OSX sleeps to RAM and as well create a sleepimage (which is the size of your RAM). In case you run out of battery, so you can still resume from the image if the battery is dead, (and you have plugged it in <img src='http://www.frederico-araujo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   Provides very fast wake up, uses the battery while sleeping.</p>
<p><strong>Fast Sleep</strong> is just sleep to RAM, same as safe sleep but no image creation, and if your battery is dead, the mac will cold boot. Provides very fast wake up same as safe sleep, uses the battery while sleeping.</p>
<p><strong>Hibernate</strong> is when it uses the sleepimage all the time. Slower sleep and slow wake up, but it does not use battery at all&#8230;</p>
<p>So&#8230;</p>
<p>I found in this website <a href="http://alt.cc/jk/2007/08/07/safe-sleep-addendum/">http://alt.cc/jk/2007/08/07/safe-sleep-addendum/</a> this nice script that handles when to FastSleep or when to Hibernate.</p>
<p>you can get safe sleep with the command  &#8220;$ sudo pmset hibernate 3&#8243;</p>
<p>I have modified the script it little :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #007800;">MODE</span>=<span style="color: #000000; font-weight: bold;">`/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pmset <span style="color: #660033;">-g</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> hibernatemode <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $2 }'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">LEFT</span>=<span style="color: #000000; font-weight: bold;">`/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pmset <span style="color: #660033;">-g</span> batt <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> Internal <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $2 }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span> <span style="color: #000000; font-weight: bold;">%</span> <span style="color: #ff0000;">'{ print $1 }'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">HIBERNATE</span>=<span style="color: #000000;">20</span>
<span style="color: #007800;">FASTSLEEP</span>=<span style="color: #000000;">50</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Running safesleep.sh =&gt; MODE: <span style="color: #007800;">${MODE}</span> LEFT: <span style="color: #007800;">${LEFT}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>system.log
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$LEFT</span> <span style="color: #660033;">-lt</span> <span style="color: #007800;">$HIBERNATE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$MODE</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000;">3</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Less than <span style="color: #007800;">${HIBERNATE}</span>% remains&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>system.log
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting Hibernate (hibernate mode 1)&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>system.log
		<span style="color: #000000; font-weight: bold;">`/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pmset <span style="color: #660033;">-a</span> hibernatemode <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span>
		<span style="color: #007800;">LS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-al</span> <span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>vm<span style="color: #000000; font-weight: bold;">/</span>sleepimage<span style="color: #000000; font-weight: bold;">`</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;The sleepimage should be created:&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>system.log
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${LS}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>system.log
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #000000; font-weight: bold;">elif</span>  <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$LEFT</span> <span style="color: #660033;">-gt</span> <span style="color: #007800;">$FASTSLEEP</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$MODE</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Greater than <span style="color: #007800;">${FASTSLEEP}</span>% remains&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>system.log
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting FastSleep (hibernate mode 0)&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>system.log
		<span style="color: #000000; font-weight: bold;">`/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pmset <span style="color: #660033;">-a</span> hibernatemode <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">`</span>
		<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>vm<span style="color: #000000; font-weight: bold;">/</span>sleepimage<span style="color: #000000; font-weight: bold;">`</span>
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>save it as /Users/your_user_name/.crons/safesleep.sh</p>
<p>now make it permanent in a crontab to run every 10 minutes, but wait, anacron (osx default cron) only supports daily/weekly/monthly jobs! (unless you patch it)</p>
<p>I guess we&#8217;ll have to install fcron:</p>
<p>$ sudo port -d install fcron</p>
<p>$ sudo vi /opt/local/etc/fcrontab</p>
<p><code><br />
@,runas(root) 10 sh /Users/your_user_name/.crons/safesleep.sh<br />
</code></p>
<p>$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.fcron.plist</p>
<p>$ sudo launchctl start org.macports.fcron</p>
<p>that&#8217;s it.</p>
<p>enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frederico-araujo.com/2008/11/01/safesleep-fastsleep-or-hibernate-osx-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Encrypt folders in Mac OSX with encfs</title>
		<link>http://www.frederico-araujo.com/2007/12/17/encrypt-folders-in-mac-osx-with-encfs/</link>
		<comments>http://www.frederico-araujo.com/2007/12/17/encrypt-folders-in-mac-osx-with-encfs/#comments</comments>
		<pubDate>Mon, 17 Dec 2007 05:01:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[encfs]]></category>
		<category><![CDATA[fuse]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.frederico-araujo.com/?p=25</guid>
		<description><![CDATA[Encrypt folders in Mac OSX with encfs
OSX already include the File Vault functionality that allows you to encrypt your whole Home Folder.
Thou the storage overhead is so small, the time to encrypt it the first time is very very long.
if you have Videos, and big files, it takes even longer.
What if I don&#8217;t want to [...]]]></description>
			<content:encoded><![CDATA[<p>Encrypt folders in Mac OSX with encfs</p>
<p>OSX already include the File Vault functionality that allows you to encrypt your whole Home Folder.<br />
Thou the storage overhead is so small, the time to encrypt it the first time is very very long.<br />
if you have Videos, and big files, it takes even longer.</p>
<p>What if I don&#8217;t want to encrypt my big folders like Movies, Music, Pictures, Pdfs?</p>
<p>I only want to encrypt my Documents folder.<br />
Be aware that VMWARE stored the virtual machine files under this folder, you should move it to outside Documents.</p>
<p><strong> WARNING: </strong></p>
<p>Be careful with this tutorial,<br />
Write down your password somewhere and BACKUP your data before going further these steps.</p>
<p>if you forget your password, say good bye to your data.</p>
<p>THERE IS NO WAY TO GET YOUR DATA BACK!!!</p>
<p><strong>TOOLS required: </strong></p>
<p><code><br />
# update your ports to get the latest encfs that runs ok on OSX10.5<br />
$ sudo port selfupdate</code></p>
<p># install encfs<br />
$ sudo port install encfs<br />
</code></p>
<p>or Download macfuse and encfs from google:</p>
<p>http://code.google.com/p/macfuse/</p>
<p>and</p>
<p>http://code.google.com/p/encfs/</p>
<p><strong>Lets move The Documents folder contents to another folder:</strong></p>
<p><code><br />
$ cd<br />
$ mkdir temp_documents<br />
$ mv Documents/* temp_documents/<br />
</code></p>
<p><strong>Create the directory to hold the encrypted files, it can be any name.</strong></p>
<p>Run this only one time. The first time to setup the folder...<br />
<code><br />
$ mkdir .documents<br />
</code></p>
<p><strong> Setup the encryption </strong><br />
<code><br />
$ encfs ~/.documents/ ~/Documents/<br />
</code></p>
<p>you will see this:</p>
<pre>
fred@Macintosh ~ $ encfs ~/.documents/ ~/Documents/
Creating new encrypted volume.
Please choose from one of the following options:
enter "x" for expert configuration mode,
enter "p" for pre-configured paranoia mode,
anything else, or an empty line will select standard mode.
</pre>
<p>now, after you pass this step, the file system will be mounted as well.</p>
<p>encfs uses FuseFS, so it behaves just like a mount point</p>
<p>to unmount it you do</p>
<p><code><br />
$ unmount ~/Documents<br />
</code></p>
<p>to mount it again issue this command:<br />
<code><br />
$ encfs ~/.documents/ ~/Documents/<br />
# or this way, which will look with better names and a folder icon on Desktop:<br />
$ encfs ~/.documents/ ~/Documents/ -- -o fsname=Documents -o volname=Documents -o local<br />
</code></p>
<p>to check mounted filesystems</p>
<p><code><br />
$ mount<br />
</code></p>
<p>you should be able to see:</p>
<p><code><br />
encfs@fuse2 on /Users/fred/Documents (fusefs, nodev, nosuid, synchronous, mounted by fred)<br />
</code></p>
<p>or this if you used the longer command.<br />
<code><br />
Documents on /Users/fred/Documents (fusefs, local, nodev, nosuid, synchronous, mounted by fred)<br />
</code></p>
<p>Now, with the encrypted folder "mounted", mv the data from that temp folder to the new encrypted folder:</p>
<p><strong> WARNING: be carefull here </strong></p>
<p><code><br />
$ cp temp_documents/* Documents/<br />
$ rm -rf temp_documents/<br />
</code></p>
<p>that's it folks.</p>
<p>Final overview:</p>
<p><code><br />
# to create the encrypted folder:<br />
$ encfs ~/.documents/ ~/Documents/<br />
#to Mount it (enable)<br />
$ encfs ~/.documents/ ~/Documents/<br />
#or<br />
$ encfs ~/.documents/ ~/Documents/ -- -o fsname=Documents -o volname=Documents -o local<br />
#to Umount it (disable)<br />
$ umount ~/Documents<br />
</code></p>
<p><b> don't change anything inside .documents</b><br />
remember the dot in the front means the folder is invisible<br />
you won't see it in Finder.</p>
<p>This also should work for Linux.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frederico-araujo.com/2007/12/17/encrypt-folders-in-mac-osx-with-encfs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
