E Text Editor | The Power of Textmate on Windows

 
Author Message

Index  >  TextMate Bundles  ~  The quick guide for installing Cygwin

bjchrist
Posted: Fri Jan 26, 2007 3:59 pm Reply with quote
Beta tester Joined: 01 Aug 2005 Posts: 277 Location: Denmark
------
Update: The cygwin installation/updates are now being handled nicely by e, so this is thread is kind of obsolete... I have therefore changed the thread to non-sticky.
------

There is a patched version of the cygwin installer that allows in installing cygwin from the command line, by specifying the packages that should be installed.



What is Cygwin, and what do I need it for?
Cygwin is a free Linux-like environment for MS Windows. Most of the bundles and snippes in e relies on tools from the linux/unix enviroment. For more information please refer to www.cygwin.com.

The quick guide for installing Cygwin
Download and run the Cygwin installer from http://www.cygwin.com/setup.exe
Select:
  • Choose A Download Source: "Install from Internet"
  • Select Root Install Directory: "c:\Cygwin"
  • Install For: "All Users"
  • Default Text File Type: "Unix / binary"
  • Local Package Directory: "c:\temp"
  • Select your Internet Connection: "Use IE5 Settings" (in most cases you should be ok with the "Direct Connection" option, but in my case I have go though a proxy server, so by using the IE5 it automatically detects the correct settings)
  • Choose A Download Site: In most cases you can just go ahead and select any of the serves, but in my case the firewall doesn't allow ftp connections, so I have to select a http server...

You should now be presented with the "package selection" dialog. I would recommend switching to the "No Installed" view by click the view button a few times until the appropriate view is displayed, this will give a much better overview than the default view.


Selecting Packages
The default selected packages are pretty much ok, but in addition to that the following packages are commonly needed be E's bundles:
  • Python
  • Perl
  • Ruby
  • Wget
  • Curl
  • Tidy

Find the additional packages that you would like to install and click the , where you can toggle between the following options (depending of what's available for the package). Don't worry too much about getting all the required packages, you can always run the installer again, and it will automatically recognize that what you previously have installed.

After selecting the packages you want to install press "next", the installer now retrieves the appropriate packages from the internet and proceed with the installation. After that the Cygwin installation is complete.

Post Installation
Due to the fact that some commands in the Cygwin environment have different names compared to the OS X environment (where most of the bundles that comes with e has been developed), it's recommended that the following symbolic links are created:

pbcopy -> putclip
pbpaste -> getclip
tac -> rev
pythonw -> python

This can be done by starting a Cygwin bash shell ("Cygwin Bash Shell" from the Start menu)
Use the ln command to create the symbolic links, e.g.:
Code:
ln -sf /bin/getclip.exe /bin/pbpaste.exe
ln -sf /bin/putclip.exe /bin/pbcopy.exe
ln -sf /bin/tac.exe /bin/rev.exe
ln -sf /bin/python.exe /bin/pythonw.exe

You are now ready to use the e bundles that require Cygwin, e automatically detects where Cygwin is located.

RubyGems
RubyGems is a system for managing Ruby software libraries. Ruby code packaged in this manner is called a gem. When you find Ruby software you want to use in a project, gems offer a means of downloading, installing and managing the software. In order to use gems, the environment variable "RUBYOPT" have to be set to "-rubygems" e.g.:

export RUBYOPT=-rubygems

Thanks for the info gtcaz: http://www.e-texteditor.com/forum/viewtopic.php?t=416

Ruby Warnings
If you have installed ruby, you get a warning like "Insecure world writable dir /usr/local/bin, mode 040777" everytime you run a ruby, this is caused by "insecure" file permissions on some directories. The obvious work-around is to remove "other" write permission from the relevant directories, by running the following commands from a bash shell:
chmod o-w /usr/local/bin
chmod o-w /usr/local
chmod o-w /usr
chmod o-w /etc
chmod o-w /usr/sbin
chmod o-w /usr/bin
chmod o-w /usr/X11R6/bin
chmod o-w /usr/X11R6
chmod o-w /cygdrive/c

Ref: http://cygwin.com/ml/cygwin/2006-01/msg00257.html

Command Line Installation:
There is a patched version of the cygwin installer that allows in installing cygwin from the command line, by specifying the packages that should be installed.

The patched version of the installer can be downloaded from here: Download the patched version of the cygwin installer at: http://staff.washington.edu/joshuadf/cygwin/cygwin-setup-p.exe

The installer takes the following options:
Code:

 -D --download                          Download from internet
 -L --local-install                     Install from local directory
 -s --site                              Download site
 -R --root                              Root installation directory
 -q --quiet-mode                        Unattended setup mode
 -h --help                              print help
 -l --local-package-dir                 Local package directory
 -r --no-replaceonreboot                Disable replacing in-use files on next
                                        reboot.
 -n --no-shortcuts                      Disable creation of desktop and start
                                        menu shortcuts
 -N --no-startmenu                      Disable creation of start menu shortcut
 -d --no-desktop                        Disable creation of desktop shortcut
 -A --disable-buggy-antivirus           Disable known or suspected buggy anti
                                        virus software packages during
                                        execution.

For example:
Code:
cygwin-setup-p.exe --root c:\cygwin --quiet-mode --site [MIRROR] --package curl,wget,tidy,perl,python,ruby --local-package-dir c:\temp\cygwin


Replace [MIRROR] with one of the sites from the list of mirror sites: http://cygwin.com/mirrors.html

Note: Not all options can be set though command line options, like setting the "Download Source" and "Internet Connection". But I did manage to find a work-around for setting those. The installer will use some default settings, or the setttings which was used during the last installation, these seetings are saved in the "last-action" and "last-connection" files in the /etc/setup directory in the cygwin installation (e.g.: c:\cygwin\etc\setup). So in case you want to download the packages and install aferwards, simply put "download,install" in the "last-action" file (or create it, in case it doesn't exists). In case you want to use you Internet Explorer settings for the connection settings, just add "ie" to the "last-connection" file.

Here is an example batch for doing the installation:
Code:

@echo off

md c:\cygwin\etc\setup
echo IE > c:\cygwin\etc\setup\last-connection
echo Download,Install > c:\cygwin\etc\setup\last-action

cygwin-setup-p.exe --root c:\cygwin --quiet-mode --site http://mirrors.dotsrc.org/cygwin/ --package curl,wget,tidy,perl,python,ruby --local-package-dir c:\temp\cygwin

echo Starting post installation

REM Post Install
c:\cygwin\bin\ln -sf /bin/getclip.exe /bin/pbcopy.exe
c:\cygwin\bin\ln -sf /bin/putclip.exe /bin/pbpaste.exe
c:\cygwin\bin\ln -sf /bin/tac.exe /bin/rev.exe
c:\cygwin\bin\ln -sf /bin/python.exe /bin/pythonw.exe

c:\cygwin\bin\chmod o-w /usr/local/bin
c:\cygwin\bin\chmod o-w /usr/local
c:\cygwin\bin\chmod o-w /usr
c:\cygwin\bin\chmod o-w /etc
c:\cygwin\bin\chmod o-w /usr/sbin
c:\cygwin\bin\chmod o-w /usr/bin
c:\cygwin\bin\chmod o-w /usr/X11R6/bin
c:\cygwin\bin\chmod o-w /usr/X11R6
c:\cygwin\bin\chmod o-w /cygdrive/c


Save the code to a batch script (e.g. "cygwin_install.bat"), in the same location as "cygwin-setup-p.exe". Now you should be able to install cygwin by executing the batch script from the command line

Thanks for the link regarding the "Automated Cygwin install" gtcaz!

Recommended Refereces:
Cygwin Setup:
http://software.jessies.org/salma-hayek/cygwin-setup.html (recommened by corelon)

Cygwin Problems:
http://software.jessies.org/salma-hayek/cygwin-problems.html (recommened by corelon)

FAQ
Q: I no longer have the need for Cygwin, how can I remove it from my computer
A: Please refer to the Cygwin FAQ: How do I uninstall all of Cygwin? http://www.cygwin.com/faq/faq_2.html#SEC20


Last edited by bjchrist on Thu Mar 08, 2007 1:09 am; edited 22 times in total
View user's profile Send private message
outofspacero
Posted: Fri Jan 26, 2007 4:15 pm Reply with quote
Registered User Joined: 30 Dec 2006 Posts: 110
thanks, this was a guide that i could have used 1 month ago, so i am sure that a lot of newcomers will appreciate this!
View user's profile Send private message
bjchrist
Posted: Fri Jan 26, 2007 5:48 pm Reply with quote
Beta tester Joined: 01 Aug 2005 Posts: 277 Location: Denmark
Yeah, the cygwin installation can be a bit confusing.

Please don't hesitate to post comments, in case there something I have missed, like extra packages or other post installation steps.
View user's profile Send private message
outofspacero
Posted: Fri Jan 26, 2007 5:56 pm Reply with quote
Registered User Joined: 30 Dec 2006 Posts: 110
bjchrist wrote:
Yeah, the cygwin installation can be a bit confusing.

Please don't hesitate to post comments, in case there something I have missed, like extra packages or other post installation steps.


There are some packages that could be used by other bundles, so a general setup wouldn't be that bad, it's only like 40-80mb

Like rxvt which cam be used as a python interpreter executor, because pymate is not working, and stuff like cat or other unix commands which i have no idea if i have to install them manually or they come with the default cygwin, so a basic setup did the trick for me.
As i check all of the macromates screencasts i find some unix commands that i learn so this list might grow bigger in the future
View user's profile Send private message
bjchrist
Posted: Fri Jan 26, 2007 7:00 pm Reply with quote
Beta tester Joined: 01 Aug 2005 Posts: 277 Location: Denmark
outofspacero wrote:

Like rxvt which cam be used as a python interpreter executor, because pymate is not working, and stuff like cat or other unix commands which i have no idea if i have to install them manually or they come with the default cygwin, so a basic setup did the trick for me.
As i check all of the macromates screencasts i find some unix commands that i learn so this list might grow bigger in the future


Good point!
The most common unix utils like cat, tail, sort, ls, etc. are available in the base package called "coreutils". You can get more info about a specific package with the info command e.g.:

info coreutils

Another cygwin command that can come in handy form time to time is the diagnostics command "cygcheck" e.g.:

cygcheck -s
or
cygcheck -c [package]

Anyways, my next step was actually to try and get pymate working. I found quite a few great hints at: http://www.e-texteditor.com/forum/viewtopic.php?t=427&highlight=pymate
Once I get it up and running I'll update the pymate thread with a recap of what I did. Please don't hesitate to post good hints at the pymate therad, if you you have some tricks - hint, hint Surprised
View user's profile Send private message
gtcaz
Posted: Fri Jan 26, 2007 7:31 pm Reply with quote
Registered User Joined: 23 Dec 2006 Posts: 732
We could make a custom install script for cygwin, with all the basics to get e running preselected. Either the e installer could offer to launch the cygwin installer, or we could have it as an optional download.

Take a look at this to see how it's done:

http://www.cygwin.com/ml/cygwin/2006-05/msg00753.html
View user's profile Send private message
myel
Posted: Sun Jan 28, 2007 8:56 pm Reply with quote
Registered User Joined: 03 Jan 2007 Posts: 380
a custom cygwin repository/mirror with the packages
and setup needed for a "perfect" e setup sounds great.

it would make it much easier for new user to use the
full capacity of e.

what i just noticed:
some of the bundles use php, but its not available via
the simple cygwin installer (or i'm blind). it seems that
you have to compile it for yourself...

(maybe the affected bundles should be altered to use
perl/ruby, except the php bundle of course?)
View user's profile Send private message
bjchrist
Posted: Mon Jan 29, 2007 11:50 am Reply with quote
Beta tester Joined: 01 Aug 2005 Posts: 277 Location: Denmark
Man, you have done it again gtcaz, thanks for the link regarding the "Automated Cygwin install"!

I have added a "Command line Installation" section to the installtion guide, what do you think?

You're right myel, the "Run PHP" bundle require php. I did a quick search on google, and found this post about installing cygwin apache+php: http://www.mail-archive.com/cygwin@cygwin.com/msg33862.html... but you might just be better off with a "normal" apache + php installtion(?). Anyways, I'll give the apache+php installtion a try Wink


Last edited by bjchrist on Mon Jan 29, 2007 2:17 pm; edited 1 time in total
View user's profile Send private message
myel
Posted: Mon Jan 29, 2007 12:14 pm Reply with quote
Registered User Joined: 03 Jan 2007 Posts: 380
that's what i found too, doesn't look like fun Wink.

the command i was interested in was "Strip HTML
Tags from Selection/Document", it uses php to
do so.

since i want to build a new, improved html-bunde
i will just rewrite that command with perl or ruby.

btw: nice batch-installation, should be integrated in the e
installer as an option at some time!
View user's profile Send private message
gtcaz
Posted: Mon Jan 29, 2007 4:53 pm Reply with quote
Registered User Joined: 23 Dec 2006 Posts: 732
In the mean time, XAMPP is quite good, but overkill just for that task.
View user's profile Send private message
myel
Posted: Mon Jan 29, 2007 8:24 pm Reply with quote
Registered User Joined: 03 Jan 2007 Posts: 380
that e requires cygwin is ok, but i will not install
xampp for one command in a bundle Wink.

i have just "rewritten" that command in ruby and will
take a look at the other commands which require php,
if there is any (except the php bundle)...
View user's profile Send private message
gtcaz
Posted: Fri Feb 02, 2007 11:44 pm Reply with quote
Registered User Joined: 23 Dec 2006 Posts: 732
myel wrote:
that e requires cygwin is ok, but i will not install
xampp for one command in a bundle ;).

i have just "rewritten" that command in ruby and will
take a look at the other commands which require php,
if there is any (except the php bundle)...


I just rewrote it in Ruby as well (forgot you'd already done it!)

Here's my solution:
http://snipplr.com/view/2097/strip-html-tags/

I figured it might be cool to have the tokenizer and node stuff for other commands.

How did you do it?
View user's profile Send private message
fajerstarter
Posted: Sun Mar 11, 2007 4:32 pm Reply with quote
Registered User Joined: 02 Dec 2006 Posts: 17
gtcaz: How would one go about to use xampp or another installation of php? I have for example installed the windows binary from php.net, and can simply call php by typing "php" in the command prompt. But how do you call it from within E?

Thanks!
View user's profile Send private message
yonta
Posted: Sun Mar 11, 2007 6:08 pm Reply with quote
Registered User Joined: 11 Mar 2007 Posts: 5
I am also interested in this. I already have xampp installed (the easy switch between php4 and 5 is great) but if i use the validate syntax command, e says it can't find the zend optimizer library - it's looking for it in the default installation (C:/programs/Zend) and not in xamp folder (C:\Programs\xampp\php\zendOptimizer).

So how do i integrate e with xampp easily?
View user's profile Send private message
charlesroper
Posted: Mon Mar 12, 2007 9:48 am Reply with quote
Registered User Joined: 06 Mar 2007 Posts: 1204 Location: UK
Well this has got me stumped too. I downloaded the PHP bundle from the Macromates repo, but the validate command in there didn't work either; PHP is found (I have it installed under Windows, not Cyg), but no file is piped into the validator. I tried hacking it a bit so that it looks like this:

Code:
#!/usr/bin/env ruby
require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
filename = `cygpath -w \"#{ENV['TM_FILEPATH']}\"`
result = `#{ENV['TM_PHP'] || 'php'} -l \"#{filename}\"`
puts result
TextMate.go_to :line => $1 if result =~ /line (\d+)/


But I this back:

Code:
Could not open input file: d:\home\mysite\public_html\blog\index.php


If I run *without* the cygdrive transformation, I get this back:

Code:
Could not open input file: /cygdrive/d/home/mysite/public_html/blog/index.php


I don't get it. The file is there and if I run the lint command from the command line it works. Any ideas anyone?
View user's profile Send private message Visit poster's website

Display posts from previous:  

All times are GMT
Page 1 of 2
Goto page 1, 2  Next
Post new topic

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum