Search code examples
makefilemv

mv command not working on mac


Here is the part of the makefile that is giving me issues:

-@mv -f -t ./ $(LIBPATH)/userfiles/*

When I run the makefile on Ubuntu it works fine however when running on my Mac I get the following error:

mv: illegal option -- t usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory

The -t flag is not defined in the man pages of my mac so I'm wondering how I can get around this.


Solution

  • Just put the destination at the end like how mv is normally used:

    -@mv -f $(LIBPATH)/userfiles/* .
    

    You are allowed to have multiple sources (such as the expanded wildcard here). The last argument is the destination. The -t flag is just a way to change this ordering if you have to for some reason, and (as you discovered) it is not always available.