How to install emacs prelude on Windows - windows

I tried following the docs exactly:
git clone git://github.com/bbatsov/prelude.git C:\emacs24.5\prelude
ln -s C:\emacs24.5\prelude C:\Users\blokeley\AppData\Roaming\.emacs.d
cd C:\Users\blokeley\AppData\Roaming\.emacs.d
Then I tried copying C:\Users\blokeley\AppData\Roaming\.emacs.d\prelude\sample\prelude-modules.el to various places:
C:\Users\blokeley\AppData\Roaming\.emacs.d\prelude-modules.el
C:\Users\blokeley\AppData\Roaming\.emacs.d\prelude\prelude-modules.el
C:\Users\blokeley\AppData\Roaming\.emacs.d\prelude\installation\prelude-modules.el
C:\emacs24.5\prelude\prelude-modules.el
When I start emacs, it starts as though prelude was not there: I don't seem to get any indication that prelude has loaded correctly at all.
For example, M-x prelude- returns no matches. I uncommented the (require 'prelude-helm) but M-x helm- returns no matches.
How do I get prelude working?

Just guessing, but if your windows version of emacs does not understand "symbolic links" (those that you create with the ln command) then it wont find your init.el file. Instead of
ln -s C:\emacs24.5\prelude C:\Users\blokeley\AppData\Roaming\.emacs.d
try to copy "C:\emacs24.5\prelude" to "C:\Users\blokeley\AppData\Roaming".

Note that on my machine, the directory ~ expands to C:\Users\blokeley\AppData\Roaming
I strongly recommend that Windows users set the HOME environment variable to something like C:\Users\YOURNAME
I managed to install prelude by:
git clone git://github.com/bbatsov/prelude.git C:\emacs24.5\prelude
ln -s C:\emacs24.5\prelude C:\Users\blokeley\AppData\Roaming
mv C:\Users\blokeley\AppData\Roaming\prelude C:\Users\blokeley\AppData\Roaming\.emacs.d
Then started emacs, which failed due to no GnuTLS being installed, so I found this issue and followed this help page which fixed it. Basically, I installed GnuTLS from http://sourceforge.net/projects/ezwinports/files/ into my emacs/bin directory and all seems to be working.
I then tried to add my old .emacs file to C:\Users\blokeley\AppData\Roaming. However, this broke prelude completely, so I found that I should simply add my customisations to
C:\Users\blokeley\AppData\Roaming\.emacs.d\personal\custom.el
I also wanted find and grep to work properly. Emacs needs the posix versions of these commands rather than the Windows versions. Luckily, I had GitHub Desktop already installed, which has them, so I added the following to my PATH environment variable before system32:
C:\Users\blokeley\AppData\Local\GitHub\PortableGit_c7e0cbde92ba565cb218a521411d0e854079a28c\usr\bin
The long code after PortableGit will be different in your case.
Happy days.

Related

-bash: ghci: command not found (Haskell interactive shell, Haskell installation )

edit : I ended up upgrading to macOS Catalina yesterday and replacing bash with zsh. One thing that should be noted is that the stackcommand worked previously, but despite all the tinkering not ghci
After deleting all the files that had anything to do with Haskell, I retried running curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
This second time there was an error with the command line tools so I had to install them manually with xcode-select --install. After rerunning the curl, I added the path to the environmental file to my zsh profile manually with :
. "$HOME/.ghcup/env"\
echo '. $HOME/.ghcup/env' >> "$HOME/.zshrc"
Here is the content of the env file :export PATH="$HOME/.cabal/bin:/Users/agnel/.ghcup/bin:$PATH"
Now everything seems to be working (I never reinstalled stack, but I think I might leave that to the side while I learn the basics of the language).
I installed the Haskell Platform yesterday but am having a hard time getting it to work correctly.
The firsts steps I did are:
curl -sSL https://get.haskellstack.org/ | sh
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
On step 1. the instructions said to append /Users/.../.local/bin the PATH variable (which I did in /etc/paths. On step 2, the script was supposed to pop up a dialog box (and didn't) when installing the necessary command line tools. It also said to rerun the script once complete (which I did). The script also said I should adjust my PATH variable, and source /Users/.../.ghcup/env in my shell configuration. It asked to this automatically but failed having not found the ~/.bashrc File. (I read that on Mac in contrary to linux, only .bash_profile is loaded upon opening of a terminal window so I adjusted the path variable there manually. I've spent forever messing around with the path variables and every time I try and run "$ ghci" I get the same -bash: ghci: command not found error message. If anyone has a solution to this problem I would be very grateful for an answer. If not, could someone with a working distribution of Haskell on their computer show me what their path variables look like?
Thanks!
A simple solution would just be to restart your terminal and you are good to go.
After installing the Haskell platform for the first time on a new mac with Catalina, I also got
~> ghci
zsh: command not found: ghci
What worked in my case was to use, instead of the plain ghci,
stack ghci
To get back the familiar behaviour, I created in my homedirectory a file named .zshrc containing
alias ghci='stack ghci'
If you open a new terminal, this file will automatically be executed.
I'd be interested to know if there is another solution.
Check if the ghcup command is working or not.
If not, make sure the .zshrc file has command for execution of ghcup. It should look something like this -
[ -f "/Users/myusername/.ghcup/env" ] && source "/Users/myusername/.ghcup/env" # ghcup-env
If the file exists, simply restarting terminal will work.
If it is still not working, set GHC as default using ghcup - follow this

which command doesn't work on my computer

In the past, we 'which' command to get the info of the relevant software on our computer, Like:
which python
which git
But now it seems don't work on my MacOS Mojave. Is there anything wrong with my setting?
New edition:
The result will turn out to be like this
AA:~ AA$ which python
/usr/bin/which: illegal option -- -
usage: which [-as] program ...
New edition2:
AA:~ AA$ type --all which
which is aliased to `alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
which is /usr/bin/which
AA:~ AA$ type -all python
python is /Users/AA/anaconda3/bin/python
python is /Users/AA/anaconda/bin/python
python is /usr/bin/python
AA:~ AA$
The alias is what causes the error message. Apparently the alias definition is simply erroneous for your system. It's not clear what defined this alias or why; it seems wrong on several levels, so I doubt it's part of the standard install.
You can remove the alias with unalias which; but I'm guessing it's defined in one of your startup files, and should be removed from there - after this point, it should be gone for good the next time you log in.
But anyway, you should not be using which - it's better to accustom yourself to the POSIX standard command type. It was introduced specifically to replace which but it's apparently still hard to eradicate the old command from people's minds.
For me, this was when something from a yarn global upgrade replaced my system's /usr/bin/which.
/usr/bin/which -> ../local/share/.config/yarn/global/node_modules/.bin/which
Since your error message is exactly the same as the text strings inside that program, it is possible that your issue is from a similar source.
console.error('which: illegal option -- ' + flag)
console.error('usage: which [-as] program ...')
"Fixed" with reinstalling which through the system's package manager (e.g. sudo dnf reinstall which). That may now interfere with whatever JavaScript package depended on that, but I plan on removing those globals, so I will not find out.
Better fix: I feel like my system is dirty now and needs all of its bin files checked... Comparing everything in /usr/local/share/.config/yarn/global/node_modules/.bin to see if it has an equivalent in /usr/bin seems like an easy enough way to look for other points of interference.
for x in $(ls /usr/local/share/.config/yarn/global/node_modules/.bin/*); do
ls -l /usr/bin/"$(basename "${x}")"
done
Then those can be checked against the system's package manager with commands like the following. Then reinstalled if needed.
sudo dnf info ...
sudo dnf provides ...
More:
Seems weird to me that it would allow clobbering existing system programs. At the very least, I would expect it to have used /usr/local/bin instead. That extra system and system-like package management seems to be why they have done away with yarn global in yarn 2 (berry).
I have different packages for sudo yarn global list and yarn global list. Maybe using sudo at some point was my mistake?
P.S. Thanks goes to #tripleee, I was unaware of type. I have seen various other ways of attempting to handle different which programs and different versions of which, along with alternatives like test (and others I have forgotten), but type looks worth trying as a replacement.
P.P.S. Annoying to find out that this OS is configured to run tab completion through which.
P.P.P.S. Yes, I know scripting with the output ls is a bad habit.

Macports does not install man pages

I'm running OSX Mavericks and have installed Macports. I installed gcc via Macports which is working fine. However when I type man gcc I only get:
No manual entry for gcc
I was told I need to add the following to my .bash_profile
export MANPATH=/opt/local/share/man:$MANPATH
which I have done with no effect. Does Macports actually install the corresponding man pages? The man page for the 'port' command works fine as well as other preinstalled tools like clang.
Any help? Cheers.
What the man command looking for is the file 'gcc.1.gz' instead.
You may simply create the symbolic link under the folder /opt/local/share/man/man1
sudo ln -s g++-mp-4.8.1.gz gcc.1.gz
I also did the same for g++.1.gz and c++.1.gz.
I've been having the same problem.
I'm not sure how macports sets the manpath or how to correctly change it in os x for that matter.
But if you do man --path you can see what the path is set to. On mine I see /opt/local/share/man is first.
If I then look for a gcc man page with find it shows me that there is in fact a man page in there
$ find /opt/local/share/man -name "*gcc*"
/opt/local/share/man/man1/gcc-mp-4.8.1.gz
So then I tried man gcc-mp-4.8.1 but that also didn't work.
In the end, it works if you just put the full path when calling man.
This works:
man /opt/local/share/man/man1/g++-mp-4.8.1.gz
Kind of crappy to have to put in the whole path but at least you can see it if you need to.
Putting export MANPATH=/opt/local/share/man:$MANPATH in your .bash_profile is correct, but it will only take effect on new terminals.

Update built-in vim on Mac OS X

I know this might be more appropriate at Ask Different, but as I tried adding tags there, there was no vim tag, only macvim. So I figured I might get a better audience here.
In the Terminal, I do the following
$ vim --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jan 31 2010 13:33:49)
When I browse to http://www.vim.org, I see a news item
Vim 7.3 released!
How do I update my built-in vim? I would very much like to do it cleanly (i.e. no duplicate installations, or any additional downloads, no macports, etc.)
I considered using Mercurial (as I already use it for other things), as per the instructions here.
$ hg clone https://vim.googlecode.com.hg/ vim
$ cd vim/src
$ make
But I think that would make a duplicate installation. Despite my "clean" requirement as mentioned above, "unclean" solutions are also welcome, since maybe there really is no other way.
If I understand things correctly, you want to install over your existing Vim, for better or worse :-) This is a bad idea and it is not the "clean" way to do it. Why? Well, OS X expects that nothing will ever change in /usr/bin unbeknownst to it, so any time you overwrite stuff in there you risk breaking some intricate interdependency. And, Let's say you do break something -- there's no way to "undo" that damage. You will be sad and alone. You may have to reinstall OS X.
Part 1: A better idea
The "clean" way is to install in a separate place, and make the new binary higher priority in the $PATH. Here is how I recommend doing that:
$ # Create the directories you need
$ sudo mkdir -p /opt/local/bin
$ # Download, compile, and install the latest Vim
$ cd ~
$ hg clone https://bitbucket.org/vim-mirror/vim or git clone https://github.com/vim/vim.git
$
$ cd vim
$ ./configure --prefix=/opt/local
$ make
$ sudo make install
$ # Add the binary to your path, ahead of /usr/bin
$ echo 'PATH=/opt/local/bin:$PATH' >> ~/.bash_profile
$ # Reload bash_profile so the changes take effect in this window
$ source ~/.bash_profile
Voila! Now when we use vim we will be using the new one. But, to get back to our old configuration in the event of huge f*ckups, we can just delete the /opt directory.
$ which vim
/opt/local/bin/vim
$ vim --version | head -n 2
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 27 2011 20:55:46)
MacOS X (unix) version
See how clean this is.
I recommend not to install in /usr/local/bin when you want to override binaries in /usr/bin, because by default OS X puts /usr/bin higher priority in $PATH than /usr/local/bin, and screwing with that opens its own can of worms.... So, that's what you SHOULD do.
Part 2: The "correct" answer (but a bad idea)
Assuming you're set on doing that, you are definitely on track. To install on top of your current installation, you need to set the "prefix" directory. That's done like this:
hg clone https://bitbucket.org/vim-mirror/vim or git clone https://github.com/vim/vim.git
cd vim
./configure --prefix=/usr
make
sudo make install
You can pass "configure" a few other options too, if you want. Do "./configure --help" to see them. I hope you've got a backup before you do it, though, in case something goes wrong....
Don't overwrite the built-in Vim.
Instead, install it from source in a different location or via Homebrew or MacPorts in their default location then add this line to your .bashrc or .profile:
alias vim='/path/to/your/own/vim'
and/or change your $PATH so that it looks into its location before the default location.
The best thing to do, in my opinion, is to simply download the latest MacVim which comes with a very complete vim executable and use it in Terminal.app like so.
alias vim='/Applications/MacVim.app/Contents/MacOS/Vim' # or something like that, YMMV
Like Eric, I used homebrew, but I used the default recipe. So:
brew install mercurial
brew install vim
And after restarting the terminal homebrew's vim should be the default. If not, you should update your $PATH so that /opt/homebrew/bin is before /usr/bin. E.g. add the following to your .profile:
export PATH=/opt/homebrew/bin:$PATH
Note: Previous versions of Homebrew did install to /usr/local, so in that case you have to use /usr/local/bin instead of /opt/homebrew/bin.
A note to romainl's answer: aliases don't work together with sudo because only the first word is checked on aliases. To change this add another alias to your .profile / .bashrc:
alias sudo='sudo '
With this change sudo vim will behave as expected!
On Yosemite, install vim using brew and the override-system-vi option. This will automatically install vim with the features of the 'huge' vim install.
brew install vim --with-override-system-vi
The output of this command will show you where brew installed vim. In that folder, go down into /bin/vim to actually run vim. This is your command to run vim from any folder:
/usr/local/Cellar/vim/7.4.873/bin/vim
Then alias this command by adding the following line in your .bashrc:
alias vim="/usr/local/Cellar/vim/7.4.873/bin/vim"
EDIT: Brew flag --override-system-vi has been deprecated. Changed for --with-override-system-vi. Source: https://github.com/Shougo/neocomplete.vim/issues/401
brew install vim --override-system-vi
This blog post was helpful for me. I used the "Homebrew built Vim" solution, which in my case saved the new version in /usr/local/bin. At this point, the post suggested hiding the system vim, which didn't work for me, so I used an alias instead.
$ brew install vim
$ alias vim='/path/to/new/vim
$ which vim
vim: aliased to /path/to/new/vim
I just installed vim by:
brew install vim
now the new vim is accessed by vim and the old vim (built-in vim) by vi

In Mac OSX 10.5, it can't find my Terminal commands sudo, find, etc

I don't know what has happened, but in my Terminal on Mac OSX 10.5 it can no longer find my sudo command, or find command, etc. They are there because if I put /usr/bin/sudo or /usr/bin/find it works fine...
My .bash_login file looks like this:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin$PATH"
My .bash_profile file looks like this:
export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Python/2.5/site-packages/django_trunk/django/bin:/usr/local/mysql/bin:/usr/bin/sudo$PATH"
I'll say now, I don't really know what I'm doing with the Terminal. I'm just a beginner to it all, and I must of done something for the environment variables (is that what they're called?) to be lost. I presumed I'd just have to make sure the /usr/bin/ path is in my bash files, but they are, and it doesn't seem to work. Please help!
Also, when I do use the /usr/bin/find command, it says "Permission denied" to me, even though I am logged into Mac OSX as the System Administrator account. I don't understand.
Any help would be grand. Thank you - James
It looks like both of your PATH exports are malformed:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin$PATH"
The end bit there won't work. It should be:
export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:$PATH
Notice the colon before '$PATH'? It's important ;)
Also, the double quotes are not necessary.
If this doesn't work, we will need more information. It is possible that something else is modifying your path even after your shell configurations are loaded.
Can you post the results of:
$ echo $PATH
Configuration files are not always a good indication of the current environment variables, since they are modified by many programs and files, all across your system. To see all of your environment variables, you can run:
$ env
This should fix the problem completely and permanently.
first, export environment paths by using below command in the terminal.
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/b‌​in
now you have the commands you want. (eg. try ls. You'll see the command is working). But this is only for the current session. If you close the terminal and open a new one, you will have the previous issue. To make this change permanent, use below command,
go to home directory
cd ~
open .bash_profile file in nano / vim (I'm using nano here)
nano .bash_profile
This will open up nano editor. In a new line, paste the following;
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:$PATH
press 'control'+'o' to save (WriteOut) and 'control'+'x' to exit nano.
All done ! Now try the commands.
Check out --- http://www.sweeting.org/mark/blog/2008/05/26/mac-os-x-tip-setting-path-environment-variables
I went trough the same issue and here is how I solved it.
First of all I reverted the file to its original doing this way
/usr/bin/nano ~/.bash_profile
In my case I was not able to make work any command alias. Even vi or vim didnt work without specifying the full path of that command.
If nano is not installed just replace nano in the command by the editor installed
After that just restart the computer. In my case as I said bellow I could not use any command. When trying to do /usr/bin/source ~/.bash_profile
that command failed. So I had to restart the OS and it worked

Resources