What's a good hex editor/viewer for the Mac? [closed]
Asked Answered
L

6

201

What's a good hex editor/viewer for the Mac? I've used xxd for viewing hexdumps, and I think it can be used in reverse to make edits. But what I really want is a real hex editor.

Litha answered 5/5, 2009 at 23:5 Comment(0)
B
396

To view the file, run:

xxd filename | less

To use Vim as a hex editor:

  1. Open the file in Vim.
  2. Run :%!xxd (transform buffer to hex)
  3. Edit.
  4. Run :%!xxd -r (reverse transformation)
  5. Save.
Bullis answered 5/5, 2009 at 23:22 Comment(8)
There also vinarise.vim plugin which makes hex editing workflow nicer.Spirograph
This is exactly why I ask candidates "teach me something I don't know about vim" in every interview. After 15 years I'm still find GOLD.Ensample
If you understand what :% ! does, then you will realize this is equivalent to doing cat filename.bin | xxd. So really this is more of a "did you know that you have an xxd command?" answer. Now that I look into it, I find that xxd also accepts a filename. So, if you only need to see the content of the binary/hex file, you can just use xxd filename.bin. Good stuff!Ensample
The problem with using xxd (and with using vim as described in this answer) is that there's no highlighting of the char and binary value. You'll need to count more characters and remember more positions to use this "dumb" binary dump effectively. Also, there's no intelligent analysis of endianness or interpretation of byte ranges as different types.Annoy
@BrunoBronosky Or xxd filename.bin | less when it doesn't fit in one screen height.Pattypatulous
@Derek朕會功夫 and reset when you forget to pipe to less and your terminal is hosed from the control characters. ;-)Ensample
when i did this vim added a trailing newline, i did set :binary and :set noeolBurp
I found that in the situation the file is with all "0x00", xxd is not working: % xxd file1 xxd: Operation timed out % xxd --version xxd 2022-01-14 by Juergen Weigert et al. % echo $SHELL /bin/zsh It's MacOS Monterey 12.4. The problem is you don't know that (all "0x00" situation) if xxd doesn't work.Falkner
U
130
  1. Open file with Xcode and press Command + Shift + J
  2. Right click file name in left pane
  3. Open as -> Hex
Unipersonal answered 19/4, 2012 at 21:57 Comment(4)
@ahcox this totally still works with Xcode 9Bantam
@ahcox perhaps you tried to open a folder, because then you will get that error.Pashm
Is there a command line option to open a file in Xcode directly into Hex mode?Vi
works in Xcode 12.4. The editor's behavior might be a bit surprising, but just keep typing...Breazeale
L
88

One recommendation I've gotten is Hex Fiend.

Litha answered 5/5, 2009 at 23:7 Comment(3)
Yea, and you can read the developer talking about fun implementing stuff on it here ridiculousfish.com/blogCollard
Also like Hex Fiend. The project moved to GitHub - so download the latest version on the releases tab instead of their previous website - github.com/ridiculousfish/HexFiend/releasesCain
It's also available on Homebrew: brew cask install hex-fiendRozellarozelle
O
24

I have recently started using 0xED, and like it a lot.

Orchestrate answered 5/5, 2009 at 23:8 Comment(5)
@JarretHardie HexFriend does not support dragging I suppose?Briquette
0xED seems to be the most simple and user-friendly of the free options out there. Just download and run, and get a side-by-side hex/ASCII view. Text editors work too, but often don't have very good binary-level editing/display options. Plus 0xED is incredibly fast; you can browse in realtime through a 1 GB file.Pleinair
0xED doesn't work at all for me (it doesn't even show a UI). macOS Mojave. I also find it fishy that there's no checksum posted on the site for the latest version.Electron
According to the official site, 0xED is no longer under active developmentEmaciation
At some point in the last year the official website went offline (domain renewed in May 21). You can still find the last release in archive.org's wayback machine. However this project isn't open source and as the developer/site is gone...so you are probably better off adopting a different tool (xxd, hexfiend, xcode, etc).Residue
R
11

There are probably better options, but I use and kind of like TextWrangler for basic hex editing. File -> hex Dump File

Rauch answered 5/5, 2009 at 23:10 Comment(5)
TextWrangler has been sunsetted/discontinued as of macOS 10.13 (High Sierra).Sabadell
BBEdit is the "replacement" for TextWrangler, looks and feels the same and offers the same features as TextWrangler, and still free. You only pay to support the developer and/or unlock more advanced features. barebones.com/products/textwranglerThreecolor
This is exactly the same for the latest version of BBeditHurff
Unfortunately, while BBEdit's free version is essentially the same, it has some notable differences from TW, especially the addition of nag stuff (menu items labeled "Pro" or whatever). TextWrangler still works well if you can grab a download.Pleinair
Can you edit hex in TextWrangler/BBEdit? I have only find a way to hexdump and read, not edit and save back to file.Milburr
L
7

The one that I like is HexEdit Quick and easy to use

Lamartine answered 6/5, 2009 at 0:22 Comment(2)
How do you compile it? Its Makefile seems corrupted, and even trying to fix it manually didn't seem to work. Can you post a correct Makefile for it?Heterochromous
Even if this source binary was ok, I trust nothing on Sourceforge.Entanglement

© 2022 - 2024 — McMap. All rights reserved.