Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I misspelled the name of a box when I added it to my box list:

vagrant box list

Can I rename the box without repackaging it?

share|improve this question

You can simply rename the dir that represents the box. If your vagrant files are in their default dir (i.e. /path/to/your/home/.vagrant.d) you can just do:

mv vagrant_path/boxes/box_to_rename vagrant_path/boxes/new_box_name

Also be sure to change the Vagrantfile to use the new label for the box. You just need to change the directive to reflect the changes.

share|improve this answer
This didn't work for me - I suspect there is a config file somewhere that needs to be updated as well. @Till's suggestion worked. – Adrian Mouat Feb 11 '14 at 11:35
@AdrianMouat: Hmm, worked for me. Did you have VMs actively running with the box in question at the time of the rename? I could imagine that maybe causing problems, though I don't really know that or why it would, necessarily. What results did you get when you tried? – lindes-hw Nov 16 '14 at 6:36
@lindes-hw I've no idea, it was 10 months ago... – Adrian Mouat Nov 17 '14 at 9:13
@AdrianMouat: fair enough. Mostly, I just wanted to not have that comment left there un-responded-to, as it detracts (to my mind) from the idea of this being a correct answer, and yet, I think it is. If there are real problems with it, though, it would be good to hear about them - whether from you, or someone else who encounters them in the future. – lindes-hw Nov 17 '14 at 18:31
@lindes-hw It might be relevant that I was running on Mac OS. I don't believe I had actively running VMs at the time; I think I would have checked that. – Adrian Mouat Nov 18 '14 at 19:11

I would do this:

$ vagrant box repackage mis-spelled-name
[vagrant] Compressing package to: /Users/johndoe/
$ vagrant box add correct-name /Users/johndoe/

Not the worst to know about these two anyway, since you can frequently update base boxes (e.g. to update the kernal, software and guest editions) to avoid running all these required updates every time you vagrant up.

share|improve this answer
Is it okay to delete the file when this is done? – Peter Hanley Oct 8 '12 at 0:33
@PeterHanley Yep. Once imported, it's ok to get rid off it. – Till Oct 8 '12 at 16:35
Thanks, I appreciate you getting back to me! – Peter Hanley Oct 10 '12 at 21:24
Note that this will take much longer than simply renaming the underlying file, and does lots of extra work that's probably not necessary in most (all?) cases. – lindes-hw Nov 16 '14 at 6:37
@lindes-hw can you show a better way? And why? – Felipe Alvarez Feb 23 at 6:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .