I recently got a new Retina MacBook Pro, with Mountain Lion. Unfortunately, emacs is taking forever to startup (around 5s) on my new computer. I tried installing the latest homebrew version of emacs, but the problem persists. I don't have a .emacs file, so I'm clueless as to what could be causing the slow startup.
What tools do I have at my disposal to debug where emacs is spending its time during startup?
It looks like you need to have a fully-qualified domain name for your computer's hostname (e.g., myretina.local); otherwise, Emacs will be slow to start.
You can verify your hostname via Terminal with
hostname
and you can set it with
sudo scutil --set HostName myretina.local
For starters, run emacs -Q (which will start Emacs with no start-up files at all), and see whether that's still slow.
You may wish to read over the following, which explains all the various possible files which Emacs will look for by default:
C-hig (emacs) Init File RET
Changing hostname didn't do anything for me. What worked wonders for me seems counter intuitive, but now my emacs starts instantly from terminal. This is what I did
alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs --debug-init
However, it still takes a few seconds, sometime even 15 seconds, to start from the graphical interface. Weird!
Emacs should start up instantaneously in your setup
Mac build (from sources)
% time /Applications/Emacs.app/Contents/MacOS/Emacs --debug-init -eval '(kill-emacs)' -Q
/Applications/Emacs.app/Contents/MacOS/Emacs --debug-init -eval '(kill-emacs) 0.19s user 0.06s system 35% cpu 0.696 total
NS build downloaded from emacsformacosx.com
% time /Volumes/Emacs/Emacs.app/Contents/MacOS/Emacs --debug-init -eval '(kill-emacs)' -Q
/Volumes/Emacs/Emacs.app/Contents/MacOS/Emacs --debug-init -eval -Q 0.17s user 0.08s system 35% cpu 0.691 total
I don't use homebrew for Emacs but it should be similar. Are you sure you're not loading non-standard packages some how?
There really is something totally broken with emacs. If nameservice collapses or routing is not fine, or your vpn tunnel is off, etc.
For us, sysadmins, starting vi is always an option:
# time emacs -debug-init -eval '(kill-emacs)' -Q
real 2m5.177s
user 0m0.029s
sys 0m0.024s
At this time the vpnc has died and caused some problems (routing and nameservice). Notice over 2 minutes!
After 30 years using emacs still do not understand why it really needs to resolve your hostname. For locking files there are better alternatives than that.
Managing hundreds/thousands of machines and VMs and setting individual host files is not really an answer. Manually it would take days/weeks and automatically generating. It really is as good as nothing.
Fixed by adding the local hostname and corresponding ip in /etc/hosts for me
Related
I'm running a bash script in the Embedded Command Line that comes with Quartus II. The bash script was sent to me from someone using linux and I was able to get most of the script to work(removing sudo, changing path, etc.). The only two commands that are still giving me errors are mkfs.ext3 and mkfs.vfat. Are these tucked away somewhere in cygwin that I need to add a path or is there another workaround? I've read some people use mkdofsf but cygwin doesn't appear to have that either.
UPDATE:
Tried using /sbin/mkfs - t vfat and /sbin/mkfs -t ext3 but this left me with a similiar error where mkfs.vfat and mkfs.ext3 were not found.
UPDATE 2: Installed e2fsprogs to solve the error with mkfs.ext3 but this doesn't solve the vfat formatting issue.
These are part of the package e2fsprogs which is available in Cygwin. I've never tried these commands, assuming that access to the raw devices would be blocked by Windows. But I see that cfdisk seems to work. It at least starts up, anyway. So, maybe it is doable.
If they don't work on raw devices, if your scripts are creating file systems on a file or can be modified to do that, that should probably work.
Anyway, e2fsprogs is what you need, but be careful here. Whenever you start making or editing file systems, you have the opportunity to really screw up your system. Just be attentive to what the script is doing, and don't blindly go forward.
I tried but get error: Process shell exited abnormally with code 255.
Mainly want this for SSH, and avoid Cygwin or plink/Putty.
I have this in config:
(setq explicit-shell-file-name "C:\\Windows\\System32\\bash.exe")
(setq explicit-bash.exe-args '("--noediting" "--login" "-i"))
(setenv "SHELL" shell-file-name)
(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)
Thank you
I use Bash for Windows with the latest Windows Creator's Update and Ubuntu 16.04 they have included. It runs quite well on Visual Studio Code and Cmder (a shell app like MobaXTerm etc). I also use ZSH instead of Bash (with oh-my-zsh and powerline9k) but i had some adjustments to do (and, it takes time to load, but i've read somewhere that Microsoft is working to fix this slow issue).
To be honest, it's a good way to replace Putty, but it has to grow a little. There's a lot of network tools that can't work on WSL for example.
I know the pain to prepare a Cygwin or use Putty, but you can take a look on MobaXterm, a really good ssh client that includes a package manager to allow you to do a lot of things from your Windows. I don't know if they use Cygwin like in the past ... But it's a ready-to-use solution with local bash shell.
To finish this and maybe help you, here is my startup line to run WSL / Bash for Windows in Cmder: bash -l -i -cur_console:p -c zsh. If you need any more information just ask :).
I am running Mac OS X ( 10.9.4 ) using the built in Terminal, and bash version:
3.2.51(1)-release (x86_64-apple-darwin13)
At one point in the past, there was a CLI command I could issue that would show me what was going on with my drives, kind of like a tail -f system.log but deeper into the system where it would look at the actual drives and what was going on. A fully idle machine, say one that was sleeping and I was ssh'd into, would show a page that was doing little or nothing. Saving a file, or doing anything disk related, and tons of data would scroll past, which you could pipe to a file and grep through.
I have goggled and can't find this command.
Not sure about Mac OS X, but on Linux, there are several:
iostat
iotop
sar
dstat
vmstat
iozone
Most of them should be available on Mac OS X. I know that iostat is.
Or you can always look in
/sys/block/[device]/stat
or
/proc/diskstats
This was in fact a duplicate of question noted by anishane.
The command I was looking for was fs_usage but lsof, while not exactly what I wanted, is a close second in being helpful to track down the problems I'm running into.
I think you are looking for iosnoop. Seems like it is a wrapper on dstat only, as when I ran it without sudo it gave me the following error.
% iosnoop
dtrace: system integrity protection is on, some features will not be available
dtrace: failed to initialize dtrace: DTrace requires additional privileges
Up until a couple days ago, I was using Gimp on OSX 10.7 normally with no issues. Then I installed Inkscape, but was unable to start it because of a language settings issue (the system is currently set to Japanese). I installed XQuartz to see if that made a difference, but it didn't, so I left it at that. Come time to do a bit of work with Gimp today, and it appears the same problems I faced with Inkscape made their way to Gimp as well (except this time it wasn't language-related). Here are the details:
Both X11 and XQuartz, when run normally, crash after briefly peeking up on the dock. A look at the Activity Monitor suggests XQuartz is trying its best behind the scenes to get started, as it is running but not visible, and starts up again as soon as I force-quit it.
When I run X11 and XQuartz from the terminal, X11 works, but gives me this:
X11.app: DISPLAY ("/tmp/launch-qlRWSF/org.macosforge.xquartz:0") does
not match our id ("org.x"), unsetting. X11.app: main(): argc=1
argv[0] = ./X11.bin
Waiting for startup parameters via Mach IPC. X11.app: Could not
connect to server (DISPLAY is not set). Starting X server. X11.app:
Launching /usr/X11/bin/startx: argv[0] = /bin/sh argv[1] = -c
argv[2] = /usr/X11/bin/startx
font_cache: Scanning user font directories to generate X11 font caches
font_cache: Updating FC cache xauth: file
/Users/christopher/.serverauth.22530 does not exist
launch_msg("CheckIn") IPC failure: Operation not permitted X11.app: No
launchd socket handed off, unsetting DISPLAY X11.app:
do_start_x11_server(): argc=6 argv[0] = /usr/X11/bin/X argv[1] =
:0 argv[2] = -nolisten argv[3] = tcp argv[4] = -auth argv[5] =
/Users/christopher/.serverauth.22530
Xquartz starting: X.Org X Server 1.10.6 Build Date: 20120513 X11.app:
DarwinProcessFDAdditionQueue_thread: Sleeping to allow xinitrc to
catchup. (EE) Error loading keymap /tmp/server-0.xkm (EE) XKB: Failed
to load keymap. Loading default keymap instead. /usr/X11/bin/xinit:
XFree86_VT property unexpectedly has 0 items instead of 1 font_cache:
Done
However, XQuartz starts without a problem from the terminal.
Finally, I found that when I call xterm from terminal, it just sits there without outputting anything or receiving any input. I think that's unusual behavior.
I checked out a couple key words from the X11 output, namely the display part and the keymap part, but found nothing out of the ordinary. The $DISPLAY value is as it should be, and the keymap seemed more connected to remote server issues than would apply in my case (these are local issues).
I appreciate any suggestions.
Ok, I was just being creatively stupid. I have been experimenting more with terminal lately, and as a result, put
exec $SHELL
in my .bash_profile. Removing that line solved my problem.
It didn't affect anything for the longest time, so I never caught it. Apparently that also affects the X11 processes.
I'm in a class that uses an implementation of Emacs on a school server. I'm on a mac running snow leopard, and I have my own implementation of Emacs on it. To access the server-Emacs, I ssh into the server and launch Emacs from its location there.
I'm relativly new to emacs, and I have a particular problem whenever I try to access the server-emacs from my local-emacs' shell-mode, having ssh'd into the server. It gives me the error that "Screen size -1x80 is too small", and doesn't launch the server-emacs.
I've the separate issue that when I try to do this in Apple's terminal, it does launch the server-emacs, but I really, really dislike the interface when emacs is launched within a terminal.
I've tried a couple of times to launch the server-emacs within a new window, in both scenarios, but apparently I'm not doing it right.
I think it'd be useful to understand what you're trying to do.
Do you just want to edit files on the server? If that's the case, read the documentation for tramp, and try:
C-x C-f //user#server:/path/to/file
If you really want to use the emacs running on the server, try creating a frame on your
(if so, look up tramp) If you want to actually use the emacs from the server, but have the window display on your mac:
ssh server
setenv DISPLAY mymac:0
emacsclient file &
This does assume you're running X11, and know how to resolve the display for your Mac. You can get X11 for the Mac here.
It's a bit hard to tell what you are doing, but you probably want to ssh to the server with an X tunnel, then run emacs there which will pop up the window on your mac.
First, don't use Terminal.
On your mac, start up X11 (google for XQuartz if you don't already have it).
Start up an XTerm (it should do this by default). From that XTerm, ssh to your server with the -Y option:
ssh -Y me#server.something
This should get you a remote shell and setup the DISPLAY environment to tunnel right back to your Mac's X server. Test it by running an xterm from there. If that works, you can instead run emacs. If that works, you can combine it with the ssh invocation:
ssh -Y me#server.something /usr/bin/emacs # or whatever path you need
You should set up ssh to not require a password but that's more than you asked for.
I think that Trey Jackson's suggestion of tramp (or the more old-fashioned 'ange-ftp) is probably your best bet.
In general, running emacs inside an emacs is never a good idea. You either want to run emacs on the server (in -nw mode inside the terminal, or via some $DISPLAY magic) or run it on your mac (via tramp). There isn't really a good way to do both.