The electronic and magnetic properties of (Ga,Mn)As and (In,Mn)As nanowires are studied by ab initio methods. The results suggest that, in contrast to the bulk, in nanowires (In,Mn)As may exhibit better ferromagnetic behavior than (Ga,Mn)As. Moreover, the calculations show that in one-dimensional diluted magnetic semiconductors the distribution of Mn ions and the magnetic order depend crucially on the crystallographic structure. Since the growth of III-V nanowires of a given, either zinc blende or wurtzite, crystal structure is nowadays well controlled, these results can help to find the preferable material and conditions for the growth of ferromagnetic semiconductor nanowires.